-
Notifications
You must be signed in to change notification settings - Fork 479
AuthHttp don't have token in the ahthorization header? #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
can you check whether your token is expired? |
i checked it, the token is still fine. |
verify you're sending a token from the network tab of your browser and that the request looks correct. |
I have the same issue ! |
@mragwa can you verify that a token is being sent via the network tab of the browser inspector, and that one is set in local storage? |
token is already set in local storage but it doesn't appear on network browser. |
what does the request look like? is it an options request? |
yes it's OPTIONS request. but the server is respond normally. |
I'm using it with IONIC2 RC4 |
You have a CORS problem, you need to fix that server side. |
Auth aside, regular http requests to the same host work? Does a regular http request work with auth if you add the token manually? |
I tried to use normal http post and add the Authorize on request header :
and in works like a charm when i convert to authHttp it doesn't work. |
so when you delete the authorization header from that snippet and swap http for authHttp it doesn't work. what's your config look like? |
yes it works when i append it manually to http header. |
@mragwa show me your config for authhttp and the actual requests (you can anonymize urls and stuff). I don't want to guess anymore. |
Just came here to post an issue and then I saw this thread. I have exactly the same issue as @mragwa. |
That's my config :
and in providers area :
I don't know what do you mean by actual requests. its just an request to local php server and it works fine it response to my request normally by "user don't have permission". |
@mragwa let me know how you fixed it |
I too am seeing the same issue. But no solution yet... I am using CORS and all seems correct. The req.headers that is coming through to the server side shows:
|
|
I looked more carefully and in the midst of my debugging I indeed lost the token. Once I fixed that, all worked correctly. And I returned things to the default setup. Thanks much for your insight. As I have always said: Stupid is really powerful. :-). |
The issue is that the library doesn't send token on "OPTIONS Preflight Request" but works properly on the others verbs (GET, POST, PUT, ...). So, when the server receives a request with verb "OPTIONS" without a token, rejects the petition, even with CORS activated and configured to allow any origin, header, and method. |
The library has nothing to do with the options preflight, and as far as I know has no control over it. It's done entirely by the browser. |
Hi, This issue helped me a lot to diagnose the case of authorization of OPTIONS in a CORS setup. The OPTIONS request is generated automatically by the browser, and it does not include the token header. To solve the case, since this OPTIONS request does not belong to the user context, it can be whitelisted and managed in a separated server security context of the application. |
The solution is to enable CORS requests from the server. This is a solution in Spring Boot by adding the "CrossOrigin" annotation
|
I have configured the AuthHttp with the following code
However when I used the AuthHttp, my server side just show there is no 'token' in the Authorization header, anything I should note ?
The text was updated successfully, but these errors were encountered: