PredixDev / predix-webapp-starter

A web application starter kit built on Polymer, Web Components, NodeJS and Predix UI Components
https://predix-webapp-starter.run.aws-usw02-pr.ice.predix.io
Other
61 stars 75 forks source link

Access token rejected because of lowercase Bearer #10

Closed sawchengling closed 6 years ago

sawchengling commented 6 years ago

Authorization header added with lowercase "bearer", causing 401 error for intelligent-mapping microservice. Quick fix by replacing to uppercase string "Bearer".

Similar issue: https://github.com/golang/oauth2/issues/113.

gstroup commented 6 years ago

I don't see any instances of lowercase "bearer" in this repository. Are you sure the problem is caused by this application?

sawchengling commented 6 years ago

I believe the authorization token returned from uaa (at least in my instance) carries a lowercase "bearer" for token_type. The addClientTokenMiddleware function use the response as it is.

gstroup commented 6 years ago

Sounds like the Intelligent Mapping service should accept "bearer"... I'll look into this. Otherwise, you'll have to write some custom code to use Intelligent Mapping.

sawchengling commented 6 years ago

The specification is not consistent across RFC6750 & RFC6749, but agree not worth spending more time on this. I initially raise this to just contribute in case anyone expanding this app running into same issue as i was stuck for a while figuring this out. Cheers.

gstroup commented 6 years ago

I got in touch with the Energy Connections team that supports that service. I learned that they are releasing new versions of Intelligent Mapping and Dynamic Mapping soon, which will accept the lowercase "bearer" in the header. Thanks for bringing this up!