Oauth2 Header - “Authorization: Bearer (token)” do

2019-07-08 10:57发布

问题:

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