[英]auth0 get all users from angular 2
I need to get all users from auth0 ( https://auth0.com/docs/api/management/v2#!/Users/get_users ) from anguler2. 我需要从anguler2获取auth0( https://auth0.com/docs/api/management/v2#!/Users/get_users )的所有用户。 this what i tried.
这是我试过的。 I know i have to add the access token somewhere.
我知道我必须在某处添加访问令牌。 Please point me to a correct direction.
请指出正确的方向。
var headers: any = {
'Accept': 'application/json',
'Content-Type': 'application/json'
};
this.authHttp.get('https://nsrevo.au.auth0.com/api/v2/users?search_engine=v2', { headers: headers})
.map(response => response.json())
.subscribe(
response => {
console.log(response);
},
error => alert(error.json().message)
);
In your headers you need to add the Authorization Bearer header with the Management APIv2 token (Which you should get from a server-side script securely) to successfully call this API: 在标题中,您需要添加Authorization Bearer标头和Management APIv2 令牌 (您应该从安全的服务器端脚本获取)以成功调用此API:
Authorization: Bearer MGMT_API_TOKEN
Also make sure the Management APIv2 token you get, has the minimum scopes required for your Application. 还要确保获得的Management APIv2令牌具有应用程序所需的最小范围。 In this case the scope should be
read:users
and read:users read:user_idp_tokens
as said in the API docs . 在这种情况下,应该
read:users
范围read:users
和read:users read:user_idp_tokens
如API 文档中所述。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.