While developers would know that they need to use Bearer in the Authorization header. it’s just not pretty. And using API consoles like the one on SwaggerHub just fails as it reuses the token_type as the prefix to the token.
It’s always “Bearer” in Apigee, See more details here. Any steps to reproduce issue that you see ?
I am not able to reproduce issue that you see. Any examples like proxy code, verify Access Token Policy & sample API will help to better understand same.
Ohhh, It’s just the name in the response. Totally understand.
You can change the response in the proxy using simple policies like JSON → XML & then using policy like XSL Transformation to change the value to Bearer & Then back to JSON. Also, Extract Variables Policy & Assign Message to change the same to Bearer with out XSL Transformation policy.
Understand that OOB will be lot better & I will pass on the feedback to Engineering Team. You can also do that using Feedback button in new Edge UI left side bar.
When you actually send the token, You actually send Authorization header with prefix “Bearer ”.
I’ve struggled with this in the past too with SwaggerHub and now with Apigee Spec Hub.
You can fix the response from the GenerateAccessToken to use token_type of “Bearer” as it should be, by using a simple JavaScript policy in the PostFlow after the OAuth policy. You can do this for all responses in the case where you may have multiple grant types with different policy names.
Here’s the JavaScript code I used:
var obj = JSON.parse(response.content);
obj.token_type = "Bearer";
context.setVariable('response.content', JSON.stringify(obj));
Yes, however, then you have to go fishing for all the values and it will vary depending on the policy name, custom attributes, etc. This approach just lets everything go through as generated by the policy.
Is there any chance that this is on anyone’s roadmap to fix? It’s apparently been an issue since at least 2015, and breaks tools such as Swagger-UI. I understand that I can manually change the response, but not having to create a workaround for something like this would be very helpful. Thanks.
For a service as large as Apigee, any incompatibility with the RFC is a serious bug. I know it’s a bit dramatic to say this, but calling your implementation OAuth 2 when you have substantial known deviations (and have known about them for over 4 years) is claiming what isn’t yours. You should be calling it OAuth 2-like rather than OAuth 2… or just fix the bugs!
I did not have any luck w/the assign message policy. It does not bring over all the values sent in the payload such as token_type, just drops that attribute along w/others from looking at the trace:
Note that the custom attributes I’ve set in the OA-GenerateAccessToken-Password policy are “externalUsername” and “externalAccessToken”. They can be accessed with or without the oauth policy prefix.
Hi @Dino-at-Google, do you have an update about this bug? I also think apigee should be RFC compliant and understand why is not now or what is the reason for not being compliant?