Login with Auth0 was successful but still a 401 'access denied' is returned?

若如初见. 提交于 2021-02-08 14:41:26

问题


I managed to get Auth0 somewhat working for my Vue.js app. The Quickstart Guide was straight forward. So what happened is that I managed to use the login functionality and was prompted with the Auth0 Login dialog. I used my google account to do a quick-login. That also worked. My google account was now visible as a new user in my Auth0 Dashboard.

However after the login I was returned to my Vue.js app but the authorization was not successful it seems.

The network tab tells me the following:

{"error":"access_denied","error_description":"Unauthorized"}

I was wondering if I have to give the user some roles or permissions before he is considered as 'authorized'? My impression was that this will be true by default and only restricted if I start defining roles in the Auth0 Dashboard.

Please enlighten me!

PS: I am using the non-implict login dialog provided by Auth0 while I am working on a SPA. I read that might cause troubles?

PS 2:

And the Raw Data of the 'Failed Exchange' Log:

{
  "date": "2020-08-24T10:43:52.005Z",
  "type": "feacft",
  "description": "Unauthorized",
  "connection_id": "",
  "client_id": "<Client_ID>",
  "client_name": null,
  "ip": "85.197.56.111",
  "user_agent": "Chrome 83.0.4103 / Linux 0.0.0",
  "details": {
    "code": "*************T8a"
  },
  "hostname": "alemanni-game.eu.auth0.com",
  "user_id": "",
  "user_name": "",
  "log_id": "90020200824104353383000015217913666506642073534760747026",
  "_id": "90020200824104353383000015217913666506642073534760747026",
  "isMobile": false
}

回答1:


I had this issue and was finally able to find out the cause of this issue. I came across this question while i was searching for the solution to the problem but it hadn't been answered. I was finally able to solve the problem and decided to answer this question.

In my case, the problem was that token endpoint was returning status code of 401 with unauthorized/access denied error and this seems to be the problem in your case too.

Problem was because of the incorrect value of "Token Endpoint Authentication Method" in the application settings.

In case of single page application, its value should be "None" but it was correctly set to "POST".

It seems that we cannot change its value, so i just created a new application and selected "Single Page Web Applications" as the application type. This solved the issue.



来源:https://stackoverflow.com/questions/63558632/login-with-auth0-was-successful-but-still-a-401-access-denied-is-returned

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