forked from auth0/react-native-auth0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (34 loc) · 943 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import Auth from './auth';
import Users from './management/users';
import WebAuth from './webauth';
/**
* Auth0 for React Native client
*
* @export
* @class Auth0
*/
export default class Auth0 {
/**
* Creates an instance of Auth0.
* @param {Object} options your Auth0 client information
* @param {String} options.domain your Auth0 domain
* @param {String} options.clientId your Auth0 client identifier
*
* @memberof Auth0
*/
constructor(options = {}) {
const { domain, clientId, ...extras } = options;
this.auth = new Auth({baseUrl: domain, clientId, ...extras});
this.webAuth = new WebAuth(this.auth);
this.options = options;
}
/**
* Creates a Users API client
* @param {String} token for Management API
* @return {Users}
*/
users(token) {
const { domain, clientId, ...extras } = this.options;
return new Users({baseUrl: domain, clientId, ...extras, token});
}
};