使用 Auth0 登录成功,但仍返回 401“访问被拒绝"? [英] Login with Auth0 was successful but still a 401 'access denied' is returned?

查看:19
本文介绍了使用 Auth0 登录成功,但仍返回 401“访问被拒绝"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法让 Auth0 对我的 Vue.js 应用程序有些作用.快速入门指南很简单.所以发生的事情是我设法使用了登录功能并被提示使用 Auth0 登录对话框.我使用我的 google 帐户进行了快速登录.这也奏效了.我的 google 帐户现在在我的 Auth0 仪表板中显示为新用户.

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.

然而,在登录后,我返回到我的 Vue.js 应用程序,但授权似乎没有成功.

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"}

我想知道在用户被视为授权"之前我是否必须给他一些角色或权限?我的印象是默认情况下这是真的,并且只有当我开始在 Auth0 仪表板中定义角色时才会受到限制.

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.

请赐教!

PS:我在处理 SPA 时正在使用 Auth0 提供的非隐式登录对话框.我读到这可能会引起麻烦?

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
}

推荐答案

我遇到了这个问题,终于找到了这个问题的原因.我在寻找问题的解决方案时遇到了这个问题,但没有得到解答.由于我能够解决这个问题,所以我决定回答这个问题.

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. As I was able to solve the problem, so I decided to answer this question.

在我的例子中,问题是令牌端点返回 401 的状态代码,带有 unauthorized/access denied 错误,这似乎也是你的问题.

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.

在单页应用程序的情况下,它的值应该是None",但它被错误地设置为POST".

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

似乎我们无法更改它的值,所以我刚刚创建了一个新应用程序并选择了单页 Web 应用程序" 作为应用程序类型.这解决了问题.

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.

这篇关于使用 Auth0 登录成功,但仍返回 401“访问被拒绝"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆