0

I have followed the accepted answer of this question to allow everyone to request my API providing that they give an auth token.

The code I have is exactly the same that in the answer.

The problem is that it removes the token-based authentication, everyone can send a request yes, but it works even without token. How should I do to have the header access-control-allow-origin → * and also a working authentication system?

Thank you for your help.

JacopoStanchi
  • 1,962
  • 5
  • 33
  • 61

1 Answers1

0

Add ->header('Authorization', 'Bearer '.$request->header('Authorization')) in the cors middleware.