标签: auth0

回调 URL 未批准用于此客户端应用程序。可以在应用程序设置中调整批准的回调 URL

我需要让我的网站用户能够使用他们的 Twitter 帐户登录我的网站。我的网站基于 Angular 8 和 Spring Boot。当我配置 Auth0 并测试我的 Twitter 应用程序时,出现以下错误:

{
  "error": "access_denied",
  "error_description": "Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings"
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

但是我正确配置了我的callback_url。那么这个问题的解决办法是什么?

twitter-oauth auth0 angular

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

如何在React中从auth0获取用户的id

我最近使用 Auth0 在我的 React Web 应用程序中实现了用户身份验证。我需要从user对象中检索一些信息。到目前为止我是这样做的:

cost { user, isAuthenticated } = useAuth0();
<p>{user.name}</p>
Run Code Online (Sandbox Code Playgroud)

但我也想获取用户的 ID,这样我就可以稍后在后端引用它们。所以我这样做了:

const { user, isAuthenticated } = useAuth0();
<p>{user.user_id}</p>
Run Code Online (Sandbox Code Playgroud)

当我访问该网站时,我得到的undefined不是用户的 ID。

发生这种情况是因为我使用开发密钥来建立社交关系,还是可能需要采取不同的方式?

javascript frontend reactjs auth0

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

类型错误:“issuerBaseURL”必须是有效的 uri

vue 应用程序不会加载它不断抱怨 IssuerBaseURL" 必须是一个有效的 uri,无论我遵循本教程https://auth0.com/blog/complete-guide-to-nodejs-express-user-authentication/

TypeError: "issuerBaseURL" must be a valid uri
    at module.exports.get (/Users/admin/Desktop/Desktop/Test/auth0-express-pug-sample-main/node_modules/express-openid-connect/lib/config.js:200:11)
    at auth (/Users/admin/Desktop/Desktop/Test/auth0-express-pug-sample-main/node_modules/express-openid-connect/middleware/auth.js:27:18)
    at Object.<anonymous> (/Users/admin/Desktop/Desktop/Test/auth0-express-pug-sample-main/src/index.js:29:3)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47
[nodemon] app crashed - waiting for file changes before starting...




App Configuration

app.set("views", path.join(__dirname, "views"));
app.set("view engine", "pug");
app.use(express.static(path.join(__dirname, "..", "public")));

app.use(
  auth({
   issuerBaseURL: process.env.AUTH0_ISSUER_BASE_URL,
   baseURL: process.env.BASE_URL,
   clientID: process.env.AUTH0_CLIENT_ID,
   secret: process.env.SESSION_SECRET,
   authRequired: false,
   auth0Logout: true,
  })
);
Run Code Online (Sandbox Code Playgroud)

vue.js auth0

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

nextjs-auth0:更新 user_metadata 后更新用户会话(无需注销/登录)

我目前正在努力在更新 user_metadata 后从 Auth0 重新获取用户数据:

下面是一个简化的 索引文件。用户选择某个对象,系统会要求将此对象(或对象 ID)添加为收藏夹。如果用户想要选择该对象作为收藏夹,我们需要更新 user_metadata 中的首选项。

// index.tsx

export default function home({user_data, some_data}) {

   const [selected, setSelect] = useState(null)
   
   async function handleAddToFavourite() {
      if (selected) {
         const data = await axios.patch("api/updateMetadata", {some_favorite: selected.id})
         // Errorhandling ...
      }
   }

   return (
      <div>
         <SearchData setData={setSelect} data={some_data}/>
         <Button onClick={handleAddToFavorite}>Add to Favorite</Button>
         <div>Selected: {selected.id}</div>
         <div>My Favorite: {user_data.user_metadata.some_favorite}</div>
      </div>
  )
}

export const getServerSideProps = withPageAuthRequired({
   returnTo: "/foo",
   async getServerSideProps(ctx) {
     const session = await getSession(ctx.req, ctx.res)
     const {data} = …
Run Code Online (Sandbox Code Playgroud)

javascript authentication auth0 next.js

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

Auth0 问题:无法为 OAuth 2.0 事务发出重定向

我正在尝试使用 Auth0 服务在 React 上进行登录开发。但目前我无法弄清楚为什么不起作用。

这是我的代码:

import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { Auth0Provider } from '@auth0/auth0-react';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <Auth0Provider
       domain="lafarfalledar.eu.auth0.com"
       clientId="Qwzp67jsGIXKk6Swnj7hUuzLMSiU9mIG"
       redirectUri={window.location.origin}>
      <App />
    </Auth0Provider>
  </React.StrictMode>
);

reportWebVitals();
Run Code Online (Sandbox Code Playgroud)

这是出现的错误:

无法为 OAuth 2.0 事务发出重定向

有人可以帮助我吗?

reactjs auth0

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

如何模拟 auth0 用户进行 Playwright 测试?

之前我们手动处理所有 auth0 逻辑,将用户信息保存在 cookie 中,自己处理所有刷新逻辑等。现在由于迁移到 vue 3,我们切换到 auth0-vue,但是我们有 e2e 测试,需要测试新用户flow,以前我们只需替换 cookie 就可以了 - 无需每次都创建新用户。但现在,当所有身份验证逻辑都发生在插件的底层时,就不可能以同样的方式做到这一点。但我们不想每次都注册一个新用户并造成不必要的混乱,并且绝对不想回滚到手动处理所有内容。

\n

关于如何解决它有什么想法吗?

\n

auth0 vuejs3 playwright

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

如何获得正确的Auth0承载令牌?

我想为我的node.js应用程序获取Auth0持票令牌.

这样做我获得了持票人令牌:

curl https://myproject.eu.auth0.com/oauth/token --data "client_id=ID&client_secret=SECRET&type=web_server&grant_type=client_credentials"

哪个归我:

{
  "access_token": *BEARER TOKEN*,
  "token_type": "Bearer"
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我在Auth标题中将该标记用于邮递员,它会告诉我: Invalid token.那么如何获得正确的承载令牌呢?

我的服务器看起来像这样:

const koa = require('koa');
const route = require('koa-route');
const jwt = require('koa-jwt');
const testRoute = require('./testRoute');

const app = koa();
//Copy pasted those values from my auth0 dashboard
const authentication = jwt({
  secret: new Buffer(*CLIENT_SECRET*, 'base64'),
  audience: *YOUR_CLIENT_ID*
});
app.use(authentication);
app.use(route.get('/test', testRoute));
app.listen(3000);
Run Code Online (Sandbox Code Playgroud)

我按照本指南进行设置:https://auth0.com/docs/quickstart/backend/nodejs/.

jwt koa auth0

3
推荐指数
1
解决办法
3276
查看次数

将Auth0与Umbraco 7集成以进行成员身份验证

我想将Auth0与Umbraco 7 集成以进行成员身份验证(成员是公共网站的用户,而不是后端CMS用户).

整合两者需要哪些步骤?

c# authentication umbraco umbraco7 auth0

3
推荐指数
1
解决办法
1173
查看次数

如何使用auth0 jwt识别用户

我有一个angular2前端,它使用Auth0进行身份验证,后端使用.net核心应用程序.所有这些都在强制执行安全的API调用.

在后端识别经过身份验证的用户的最佳方法是什么?我可以想到这样做的一个相当笨拙的方法是公开一个'setUserToken'api调用,它允许我将用户ID连接到以下任一项:

  • 代币 var bearerToken = Request.Headers["Authorization"].ToString()

  • 社交ID var socialId = User.Claims.Where(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier").First().Value

这样,随后的API调用,我可以简单地findUserByToken()findUserBySocialProviderOpenId()

我确定我错过了一个更明显的解决方案来解决这个问题.任何指导将不胜感激.

rest jwt auth0 asp.net-core

3
推荐指数
1
解决办法
1688
查看次数

如何将HashLocationStrategy与Auth0 Lock小部件一起用于用户登录

更新后Auth0登录样品使用HashLocationStrategyapp.module.ts:

import { LocationStrategy, HashLocationStrategy } from '@angular/common';
// (...)
@NgModule({
  providers: [
    {provide: LocationStrategy, useClass: HashLocationStrategy},
    appRoutingProviders,
    AUTH_PROVIDERS
  ],  
//(...)
Run Code Online (Sandbox Code Playgroud)

Auth0 Lock authenticated事件不再被引发:

import { Injectable } from '@angular/core';
import { tokenNotExpired } from 'angular2-jwt';

// Avoid name not found warnings
declare var Auth0Lock: any;

@Injectable()
export class Auth0Service {

  // Configure Auth0
  lock = new Auth0Lock('I21EAjbbpf...', '....au.auth0.com', {});

  constructor() {
    // Add callback for lock `authenticated` event
    this.lock.on("authenticated", (authResult) => { …
Run Code Online (Sandbox Code Playgroud)

auth0 angular2-routing angular

3
推荐指数
1
解决办法
1608
查看次数