我尝试使用 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:令牌已更改。
尝试让 auth0 与我的电子应用程序一起使用。当我按照默认教程并尝试使用用户名-密码-身份验证进行身份验证时,锁定失败并显示 403 错误,并响应“不允许使用 Origin file://”。
我还在 auth0 仪表板中客户端设置的允许来源 (CORS) 部分添加了“file://*”。
编辑:
电子中的锁定设置
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) 我目前正在开发一个使用 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”
我没有修改任何这些文件。
这是角度版本问题吗?我使用了这些库的错误版本吗?
感谢您的帮助!
我正在使用 Loopback 版本 4(一个 Node.js 框架)的项目。我需要使用 Auth0 实现身份验证。但是,Auth0 似乎与 Loopback 的第 4 版不兼容。我找不到关于这个主题的任何文档,甚至是教程。有人曾经在 Loopback 4 中使用 Auth0 实现身份验证吗?
我编写了一个 ASP.NET Core Web 应用程序,它使用 Auth0 作为用户的主要授权机制,它中间人是一大堆外部身份验证端点,例如 Google 和 Facebook。这工作得很好,我在那里没有任何问题。
该网络应用程序的核心利用 Google Analytics 来执行自己的分析和业务逻辑。我的网络应用程序正在分析的 Google Analytics 帐户可能并且很可能与用户自己的 Google 帐户不同。需要明确的是,我的意思是,用户很可能会使用他们希望的任何登录提供商登录,然后他们将附加一个特定的 Google 企业帐户,可以访问其企业的 Google Analytics 系统。
Web 应用程序在用户登录和离线时执行分析。
因此,我始终将用户身份验证 (Auth0) 步骤与 Analytics 帐户步骤的身份验证分开。大致流程如下:
之前我也通过 Auth0 推送 Analytics 身份验证,并且使用缓存的 Auth0 刷新令牌来离线工作。然而,它会在几天后过期,并且 Auth0 似乎不提供长期离线访问。
因此,我认为最简单的方法就是不使用 auth0 进行 Analytics 身份验证步骤,直接使用 Google API 进行身份验证并长期存储 Google 刷新令牌。但是我找不到任何具体的例子来说明如何实现这一目标!
c# google-api google-api-dotnet-client asp.net-core-mvc auth0
我正在尝试使用 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) 我正在尝试使用 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) 我正在用 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
auth0 ×10
c# ×2
angular ×1
asp.net-core ×1
django ×1
electron ×1
expo ×1
google-api ×1
javascript ×1
loopback ×1
node-modules ×1
node.js ×1
oauth-2.0 ×1
python ×1
react-native ×1
restsharp ×1
saml-2.0 ×1
typescript ×1
unauthorized ×1