Tag: auth0

Auth0创build用户问题

我试图创build一个已经在我的Auth0退出的用户。 为此,我使用mngClient.users.create 我碰到的问题是, APIError: {"statusCode":400,"error":"Bad Request","message":"The user already exists.","errorCode":"auth0_idp_error"}我得到一个错误,看起来像APIError: {"statusCode":400,"error":"Bad Request","message":"The user already exists.","errorCode":"auth0_idp_error"} 有时我得到错误,看起来像Bad Request: The user already exists. 这是什么原因?

Angular + Node + Express:带sendFile方法的意外标记

我有点卡在这里。 我在客户端使用Angular 4编写Web应用程序,在服务器端使用Node / Express / Mongo编写REST API,并使用Auth0 API进行validation。 在服务器端,我提供静态文件和所有路由到Angular: const distDir = __dirname + "/dist/"; app.use(express.static(distDir)); app.get('/*', function(req, res) { res.sendFile(path.join(__dirname + '/dist/index.html')); }); 没有提供所有的Angular应用程序的app.get方法,我得到一个404错误(例如不能GET /callback)。 问题是sendFile发送一个html文件,无论调用什么。 在我的应用程序中,第一次调用的是js文件,如“networking”选项卡(auth0.min.js)中所示。 所以我得到这个错误: ERROR SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at e.CPp0.t.json (vendor.b69a8a4fa217eba4fba0.bundle.js:1) at e.project (main.0e8acae237e497f792ab.bundle.js:1) at e._next (vendor.b69a8a4fa217eba4fba0.bundle.js:1) at e.T14+.e.next (vendor.b69a8a4fa217eba4fba0.bundle.js:1) […]

在CouchDB(Cloudant < – > PouchDB)中实现“数据库每用户模式”

任何人都可以提供一个简单的例子,如何在CouchDB(Cloudant < – > PouchDB)中实现“数据库每用户模式”? 用户使用Auth0(jwt)进行身份validation。 我无法find关于这个主题的东西。 任何帮助,将不胜感激!

Nodejs减lessjsonwebtoken的长度

我是nodejs的初学者。 我使用jsonwebtokens使用nodejs进行login系统。 有人可以告诉我什么参数生成令牌的长度取决于。 它只取决于使用的秘密string或任何其他参数。 另外我们如何减less生成的令牌的大小。 现在为我所做的生成大约1100个字符的令牌。

带有Angular2的Auth0“提供的参数不匹配调用目标的任何签名”。

我目前正在尝试用我的Angular2应用程序设置Auth0。 我正在使用angular2-cli。 我添加了一个称为auth的新服务。 当我运行npm start我得到错误src/app/auth.service.ts (21,5): Supplied parameters do not match any signature of call target. 这是我的auth.service.ts import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import 'rxjs/add/operator/filter'; import * as auth0 from 'auth0-js'; @Injectable() export class AuthService { auth0 = new auth0.WebAuth({ clientID: 'removed for privacy', domain: 'removed for privacy', responseType: […]

如何使用auth0和node.js在服务器中获取user.email?

在我的前台,我可以通过以下方式看到电子邮件: console.log(auth.profile.email) 然后我调用这个服务来从后端检索一些信息,它是受保护的,所以你需要login以取回任何东西: var metadata_req = { method: "GET", url: "http://localhost:80/protected/all/metadata" } 在后端,我正在使用node.js,并在做请求之前validation用户是否已login。 var jwtCheck = express-jwt({ secret: new Buffer(config.secret, 'base64'), audience: config.client_id }); 但是如果我打印req.user,我只能看到iss,sub,aud,exp和iat。 我也希望看到电子邮件。

Angular 2 – Auth0

我正在尝试执行login并从Auth0注册。 我从Auth0网站按照以下步骤操作: https://auth0.com/docs/quickstart/spa/angular2/01-login 我正在使用Angular 2 RC5 这是我的文件是这样的: app.component.html <div class="navbar-header"> <a class="navbar-brand" href="#">Auth0 – Angular 2</a> <button class="btn btn-primary btn-margin" (click)="auth.login()" *ngIf="!auth.authenticated()">Log In</button> <button class="btn btn-primary btn-margin" (click)="auth.logout()" *ngIf="auth.authenticated()">Log Out</button> </div> app.component.ts 从'@ angular / core'导入{Component}; 从“./auth.service”导入{Auth}; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], }) export class AppComponent { constructor(private auth: Auth) {} } auth.service.ts […]

Auth0 / userinfo端点返回未经授权的错误

即使在Node.js应用程序中传递不记名标记,它也会导致未经授权的结果错误。 function getUser(authData){ var postData = querystring.stringify({ authorization: authData }); var options = { host: 'pole.auth0.com', method: 'GET', path: '/userinfo' }; //make request httpsRequest(postData, options) .then(function(result) { // success res.status(201).send({ 'success': true }); }, function(err) { res.status(500).send({ 'success': false, 'reasonCode': "Internal error." }); }); }; 帮手function: function httpsRequest (data, options) { return new Promise(function (resolve, […]

NodeJS JWT令牌validation

我试图validation签名令牌,并使用NodeJS从它提取信息。 我现在在浏览器中有一个名为userToken的token,login后我保存了(我用auth0login)。 我尝试在这里手动validation我的令牌: http : //jwt.io ,它工作,并给我有效载荷数据没有问题。 但是,我不能用NodeJS做同样的事情。 我该怎么做? 我阅读文档,但我无法得到它。 https://github.com/auth0/express-jwt 这是我的server.js var http = require('http'); var express = require('express'); var cors = require('cors'); var app = express(); var jwt = require('express-jwt'); var dotenv = require('dotenv'); dotenv.load(); var authenticate = jwt({ secret: new Buffer(process.env.AUTH0_CLIENT_SECRET, 'base64'), audience: process.env.AUTH0_CLIENT_ID }); // view engine setup var path = […]

validation节点PEM_read_bio_PUBKEY上的RS256 jwt失败

我试图我试图validation使用RS256algorithm的jwt 。 当使用hs256algorithm一切工作正常 let opts = { audience: 'y', issuer: `https://x.auth0.com/`, algorithms: ["RS256"] } jwt.verify(payload.token, 'secret', opts, (err, decoded) => { if (err) { console.log("invalid token in iamonline service " + err.message); return; } 我不断收到错误: PEM_read_bio_PUBKEY failed 虽然auth0有这样做的文档 ,它假定你使用快递,我不是。 我正在通过WebSocket这样做,所以没有中间件。 令人讨厌的是, HS256对我来说很好,但auth0自定义login表单似乎需要RS256 。