Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function handle($request, Closure $next)
- {
- $origin = $request->server('HTTP_ORIGIN');
- $domains = ['http://localhost:8080', 'http://localhost:3000'];
- if ($origin) {
- if (in_array($origin, $domains)) {
- return $next($request)
- ->header('Access-Control-Allow-Origin', '*')
- ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
- ->header('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, X-Requested-With, Application');
- }
- }
- return $next($request);
- }
- getSecretCode: function () {
- const data = {
- grant_type: 'password',
- client_id: 4,
- client_secret: 'yoT0rjWGHGbzAzbqJkkEEvCnPWcjRK79tSxhGLjH',
- username: 'domenica37@example.com',
- password: 'secret',
- scope: '*',
- }
- axios.post('http://127.0.0.1:8000/oauth/token', {data}).then((response) => {
- console.log(response);
- }, (error) => {
- console.log(error)
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement