本文介绍了使用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. I was finally able to solve the problem and decided to answer this question.

在我的情况下,问题是令牌端点正在返回状态代码为 401 且错误代码为 unauthorized/access拒绝,这在您的情况下也是问题所在

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.

对于单页应用程序,其值应为无" ,但错误地将其设置为"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“拒绝访问"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 16:56