标签: auth0

发送 OAuth 令牌在 Postman 中有效,但在 RestSharp 中无效

我尝试使用 Postman 将不记名令牌发送到 Auth0 API,效果非常好。

然后我尝试使用 RestSharp (在 c# 中)进行相同的操作,但它根本不起作用。

下面是我的代码。我尝试了许多不同的格式,但没有一个能工作。我还有其他方法可以尝试使其工作吗?

var client = new RestClient("http://domain.auth0.com/api/v2/users");

RestRequest request = new RestRequest(Method.GET);
//request.AddHeader("authorization", "Bearer eyJhbGcJ9.eyJhdWQiOiJ6VU4hVWUE2.token");
//request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
//request.AddHeader("Accept", "application/json");


//RestClient client = new RestClient("http://domain.auth0.com");
//RestRequest request = new RestRequest("api/v2/users", Method.GET);

request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Accept", "application/json");
request.AddParameter("Authorization",
string.Format("Bearer " + "eyJhbGciOI1NiIsI9.eyJhdWQiOiWmVhTWpD2VycyI6eyJhY.token"),
            ParameterType.HttpHeader);

//request.AddParameter("Authorization",
//    String.Format("Bearer {0}", token),
//ParameterType.HttpHeader);
var response = client.Execute(request); 
Run Code Online (Sandbox Code Playgroud)

PS:令牌已更改。

restsharp oauth-2.0 auth0

4
推荐指数
1
解决办法
3845
查看次数

如何使用 OpenIdConnectMiddleware 设置受众?

OpenIdConnectMiddleware在 ASP.NET Core 2.0 应用程序中使用 Auth0 作为身份验证。

我已经按照这个指南通过Auth0实现了身份验证,并且可以成功登录。

现在我想使用检索到的访问令牌来访问单独的 API;为此,我需要audience在使用 Auth0 授权时包含一个参数,如此处所述

由于 OpenID Connect 中间件使用 Auth0 处理授权,并且 没有Audience设置OpenIdConnectOptions,我如何指定audience应该传递给/authorize端点的参数?

c# openid-connect auth0 asp.net-core

4
推荐指数
1
解决办法
861
查看次数

Electron Auth0Lock“原始文件://不允许”

尝试让 auth0 与我的电子应用程序一起使用。当我按照默认教程并尝试使用用户名-密码-身份验证进行身份验证时,锁定失败并显示 403 错误,并响应“不允许使用 Origin file://”。

我还在 auth0 仪表板中客户端设置的允许来源 (CORS) 部分添加了“file://*”。

Auth0 锁定并出现控制台错误

不允许原始文件://

编辑:

电子中的锁定设置

var lock = new Auth0Lock(
   'McQ0ls5GmkJRC1slHwNQ0585MJknnK0L', 
   'lpsd.auth0.com', {
    auth: {
            redirect: false,
            sso: false
    }
});

document.getElementById('pill_login').addEventListener('click', function (e) {
    e.preventDefault();
    lock.show();
})
Run Code Online (Sandbox Code Playgroud)

javascript node.js auth0 electron

4
推荐指数
1
解决办法
1002
查看次数

Auth0 令牌端点身份验证方法已淡出?

我想将客户端设置中的此字段更改为“无”以外的其他字段,但它显示为灰色,我无法更改它。我还有什么事情要做吗? 在此输入图像描述

auth0

4
推荐指数
1
解决办法
1322
查看次数

找不到模块“@auth0/angular-jwt/”

我目前正在开发一个使用 ADFS 身份验证的 Web 应用程序。

我有以下运行时错误:

“找不到模块@auth0/angular-jwt”。

我正在使用Angular 5.2.10。我尝试重新安装我的依赖项,但仍然有错误:

我有以下错误index.d.ts

找不到名称“Provider”和“ModuleWithProviders”

并在jwt.interceptor.d.ts

找不到模块“@angular/common/http”和“rxjs/internal/Observable”

并在jwtoptions.token.d.ts

找不到模块“@angular/core”

我没有修改任何这些文件。

这是角度版本问题吗?我使用了这些库的错误版本吗?

感谢您的帮助!

node-modules typescript auth0 angular

4
推荐指数
1
解决办法
1万
查看次数

有没有办法将 Auth0 集成到 Loopback 4?

我正在使用 Loopback 版本 4(一个 Node.js 框架)的项目。我需要使用 Auth0 实现身份验证。但是,Auth0 似乎与 Loopback 的第 4 版不兼容。我找不到关于这个主题的任何文档,甚至是教程。有人曾经在 Loopback 4 中使用 Auth0 实现身份验证吗?

authentication loopback auth0

4
推荐指数
1
解决办法
780
查看次数

添加 Google API 离线访问 .NET Core 应用程序

我编写了一个 ASP.NET Core Web 应用程序,它使用 Auth0 作为用户的主要授权机制,它中间人是一大堆外部身份验证端点,例如 Google 和 Facebook。这工作得很好,我在那里没有任何问题。

该网络应用程序的核心利用 Google Analytics 来执行自己的分析和业务逻辑。我的网络应用程序正在分析的 Google Analytics 帐户可能并且很可能与用户自己的 Google 帐户不同。需要明确的是,我的意思是,用户很可能会使用他们希望的任何登录提供商登录,然后他们将附加一个特定的 Google 企业帐户,可以访问其企业的 Google Analytics 系统。

Web 应用程序在用户登录和离线时执行分析。

因此,我始终将用户身份验证 (Auth0) 步骤与 Analytics 帐户步骤的身份验证分开。大致流程如下:

  1. 用户使用任何提供商(Google、Facebook、电子邮件/通行证)通过 Auth0 登录并访问私人仪表板。
  2. 用户设置一个“公司”并单击一个按钮来授权我们的网络应用程序访问带有 Analytics 的特定 Google 帐户。
  3. 用户将被重定向回私人仪表板,并且 Google 帐户的刷新令牌将被存储以供将来使用。

之前我也通过 Auth0 推送 Analytics 身份验证,并且使用缓存的 Auth0 刷新令牌来离线工作。然而,它会在几天后过期,并且 Auth0 似乎不提供长期离线访问。

因此,我认为最简单的方法就是不使用 auth0 进行 Analytics 身份验证步骤,直接使用 Google API 进行身份验证并长期存储 Google 刷新令牌。但是我找不到任何具体的例子来说明如何实现这一目标!

  • 官方 Google API .NET 示例- 这似乎非常古老,并且 ASPNET Core 并不真正支持。我看不出有什么明确的方法可以将其塑造成任何可用的东西,并且搜索SO发现了明显的问题。
  • 所以回答类似的问题- 这是一个很好的答案,但实现是针对用户身份验证的,我认为在我的场景中不起作用。

c# google-api google-api-dotnet-client asp.net-core-mvc auth0

4
推荐指数
1
解决办法
1081
查看次数

React-Native Expo 应用程序 Auth0 登录,AuthSession - authURL 失败

错误截图我正在尝试使用 AuthSession 设置登录到我的 React Native Expo 应用程序。

我不断收到此错误:ValidationError:子“authUrl”失败,因为 [“authUrl”必须是有效的 uri]”。

奇怪的是,如果我通过控制台记录正在传递的 URI,复制它并将其粘贴到浏览器中,它就可以工作!(按预期拉出 Auth0 登录屏幕)。

为什么我在尝试从 Expo 客户端应用程序调用它时会收到此错误?

这是我的代码:

 function toQueryString(params) {
  return '?' + Object.entries(params)
    .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
    .join('&');
}

class SignInScreen extends React.Component {

logIn = async () => {
  const redirectUrl = AuthSession.getRedirectUrl();
  console.log(`Redirect URL: ${redirectUrl}`);

  // Structure the auth parameters and URL
  const queryParams = toQueryString({
    client_id: auth0ClientId,
    redirect_uri: redirectUrl,
    response_type: 'id_token', // id_token will return a JWT token
    scope: 'openid profile', // retrieve the user's …
Run Code Online (Sandbox Code Playgroud)

authentication auth0 react-native expo

4
推荐指数
1
解决办法
2386
查看次数

InvalidSignatureException:签名无效

我正在尝试使用 ITFoxtec-saml 和 Auth0 作为 IdP。但在 ACS 上,我收到以下错误:

ITfoxtec.Identity.Saml2.Cryptography.InvalidSignatureException: Signature is invalid.
   at ITfoxtec.Identity.Saml2.Saml2Request.ValidateXmlSignature(SignatureValidation documentValidationResult) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Request\Saml2Request.cs:line 237
   at ITfoxtec.Identity.Saml2.Saml2Request.Read(String xml, Boolean validateXmlSignature) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Request\Saml2Request.cs:line 204
   at ITfoxtec.Identity.Saml2.Saml2Response.Read(String xml, Boolean validateXmlSignature) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Request\Saml2Response.cs:line 66
   at ITfoxtec.Identity.Saml2.Saml2AuthnResponse.Read(String xml, Boolean validateXmlSignature) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Request\Saml2AuthnResponse.cs:line 214
   at ITfoxtec.Identity.Saml2.Saml2PostBinding.Read(HttpRequest request, Saml2Request saml2RequestResponse, String messageName, Boolean validateXmlSignature) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Bindings\Saml2PostBinding.cs:line 106
   at ITfoxtec.Identity.Saml2.Saml2PostBinding.UnbindInternal(HttpRequest request, Saml2Request saml2RequestResponse, String messageName) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Bindings\Saml2PostBinding.cs:line 96
   at ITfoxtec.Identity.Saml2.Saml2Binding`1.Unbind(HttpRequest request, Saml2Response saml2Response) in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\src\ITfoxtec.Identity.Saml2\Bindings\Saml2Binding.cs:line 70
   at TestWebAppCore.Controllers.AuthController.AssertionConsumerService() in C:\Documents\Repos\ITfoxtec.Identity.Saml2-master\ITfoxtec.Identity.Saml2-master\test\TestWebAppCore\Controllers\AuthController.cs:line 58
Run Code Online (Sandbox Code Playgroud)

saml-2.0 auth0 itfoxtec-identity-saml2

4
推荐指数
1
解决办法
2699
查看次数

未经授权的客户端:客户端不允许授予类型“authorization_code”。Django -auth0 -login

我正在用 django 开发一个应用程序,当我尝试使用 auth0 进行登录时,我得到:

"error": {
  "message": "Grant type 'authorization_code' not allowed for the client.",
  "oauthError": "unauthorized_client",
  "type": "oauth-authorization"
}
Run Code Online (Sandbox Code Playgroud)

我已经配置了我的公钥和私钥、登录网址,并且在 auth0 中我已经配置了网址。

此外,我注意到错误可能是在我询问 access_token 时,因为我在访问 auth0.com/oauth/token 时遇到了 http 403 错误。

同时服务器向我发送了这个“GET /complete/auth0?redirect_state=y8oPFziJ01BmdGaRbsRJZod3GZ4dP0hW HTTP/1.1”500 116725

python django authorization unauthorized auth0

4
推荐指数
1
解决办法
1289
查看次数