Hi,
I'm getting invalid access token in response when get request send to an Apigee API. I'm using angular 6 which makes get request to Apigee API. For OPTIONS request, getting status OK 200, but when get request is sent it is throwing 401 unauthorized error.
Response shown in network :
{"fault":{"faultstring":"Invalid access token","detail":{"errorcode":"oauth.v2.InvalidAccessToken"}}}
error displayed in console:
I can see following in Trace:
Also tried in Postman, there it is giving same invalid access token response.
@Siddharth_Barahalikar
Hi @Maskiri PL, This error means that No Auth Header is found by Oauth policy.
{"fault":{"faultstring":"Invalid access token","detail":{"errorcode":"oauth.v2.InvalidAccessToken"}}}
Did you try calling the APIGEE Proxy URL directly from postman with Oauth token in header?
What is the other policy in the Trace? Is it from Fault rules? If yes, what is the Conditions mentioned for it?
That means the token is invalid!
(Maybe that was obvious to you)
WHY is the token invalid. There are several possibilities.
The first case is probably most likely.
If you simply send a GET request, chances are there is no authorization header.
If your proxy uses a OAuthV2/VerifyAccessToken policy, then it implicitly expects an inbound Authorization header. Therefore, you get the error.
The fix is to make sure you are passing a header of the correct form, with a valid token.
If you are now wondering "how can I get a token?" ... try this video.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |