aws-appsync-community icon indicating copy to clipboard operation
aws-appsync-community copied to clipboard

OpenID Authorisation can't handle "Bearer " in header value

Open jaffacake opened this issue 4 years ago • 13 comments

I've just been trying out AppSync's authorisation setup for OpenID (using it with Auth0). However, I hit issues when testing because I couldn't get it to authenticate from Postman, but it was working from the AppSync Query console.

It took me a while to debug & monitoring the request the console was sending to realise that it was sending a different header value to Postman. Postman adds Bearer to most standard Authorisation standards.

At the moment, I've had to manually set a header, this is going to complicate our testing of the API as we can't use standard authorisation headers.

Can AppSync be changed to also handle a preceding Bearer in the authorisation header value?

jaffacake avatar Apr 09 '20 08:04 jaffacake

Thank you for the feedback. That is indeed the case as you mentioned. I will add this internally as a feature request.

itrestian avatar Apr 23 '20 03:04 itrestian

Also just to add a perspective. We have several microservices, where App sync is being used in one of them. Here all the other services use JWT tokens with "Bearer" prepended, But this doesn't work with AppSync. This forces the calling layers to do ugly tricks. My goal is to add more weightage to the feature request.

Also, I would be happy to contribute to it. (I would need to some basic guidelines over how is the project structured etc.)

bhuvinth avatar May 26 '20 09:05 bhuvinth

Is there any update on this? We have hit this problem as well and is going to cause us quite a few headaches as we do not control the clients that will be calling our API.

danieljack2 avatar Sep 03 '20 02:09 danieljack2

Could this behaviour at least be explicitly mentioned in the documentation until it gets resolved? That'd save hours of confusion for many developers trying to make their API calls work.

Any news about this?

EmiiFont avatar Jul 07 '21 15:07 EmiiFont

We have the same issue from Event Bridge - Api Destination (always call with Bearer) to Appsync

sonphnt avatar Nov 24 '21 12:11 sonphnt

How is this marked as an enhancement as it's clearly broken? Your EventBridge service does not work with AppSync because it's broken. You expect people to crawl through github issues to find resolution only to find this 'issue' listed as an enhancement. Well done...

cevatkerim avatar Dec 15 '21 15:12 cevatkerim

I have run into the same issue. I have interceptors set up by default that inject Authorization header value on Angular side and this works transparently. Also as expected it adds Bearer to the Authorization header and it does not work with AppSync. If AppSync can handle the Bearer string in the Authorization header value, then it would make the integration with existing auth tools seamless using OpenId auth mode.

csgyuri avatar Dec 20 '21 09:12 csgyuri

Took me 2 hours to understand why a standard "Authorization: Bearer ..." header doesn't work. Not a single line about it in the docs.

The OIDC standard explicitly mentions the Bearer keywork: https://datatracker.ietf.org/doc/html/rfc6750#section-2.1

When sending the access token in the "Authorization" request header field defined by HTTP/1.1 [RFC2617], the client uses the "Bearer" authentication scheme to transmit the access token.

For example:

>      GET /resource HTTP/1.1
>      Host: server.example.com
>      Authorization: Bearer mF_9.B5f-4.1JqM

asyschikov avatar Mar 29 '22 22:03 asyschikov

I spent a few hours trying to figure out why my bearer token is not working, until I came across this issue page. Can we get a fix for this soon, or update the documentation to reflect this?

vinodabh avatar Apr 15 '22 15:04 vinodabh

We need this also, we are facing the same issue with the Event Bridge -> AppSync integration and we lost several hours struggling until we arrived here.

sebastiansanio avatar May 25 '22 13:05 sebastiansanio

+1

nacho8 avatar May 25 '22 13:05 nacho8

Any news when this issue will be fix ?

dragonfly8391 avatar Jul 06 '22 23:07 dragonfly8391

We have made appropriate changes to support Bearer authorization header for OPENID_CONNECT and AMAZON_COGNITO_USER_POOLS authorization.

yashpatel6892 avatar Aug 31 '22 22:08 yashpatel6892