Oauth2 Header - “Authorization: Bearer (token)” doesn't work

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 01:37:19

问题


I am using Lumen as backend. I successfully authenticated user and got the token, but when I am trying to get protected data, it doesn't let me with Authorization: Bearer TOKEN. I tried with both Postman & Swift. ( I also tried Authorization: BearerTOKEN )

I tried making a call from ios app and adding header: Authorization: Bearer y57WWNRNKNpJkXugT6v1YG7Et13PBgT5xNkAB1bg however it doesn't let me pass the validation. Specifically:

    let headers = ["Authorization": "Bearer \(token)"]

Then I tried in postman: GET, set headers:

  • Authorization Bearer y57WWNRNKNpJkXugT6v1YG7Et13PBgT5xNkAB1bg

Still no luck. I am getting

error = "access_denied";

"error_description" = "The resource owner or authorization server denied the request.";

P.S: /me?access_token = 84389... works fine

来源:https://stackoverflow.com/questions/34036781/oauth2-header-authorization-bearer-token-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!