forked from KKBOX/OpenAPI-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuth.js
More file actions
26 lines (24 loc) · 736 Bytes
/
Copy pathAuth.js
File metadata and controls
26 lines (24 loc) · 736 Bytes
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
import ClientCredentialsFlow from './ClientCredentialsFlow'
import TokenFetcher from './TokenFetcher'
/**
* Implements various KKBOX OAuth 2.0 authorization flows.
*/
export default class Auth {
/**
* Initialize the Auth object with client id and client secret.
*
* @param {string} client_id
* @param {string} client_secret
* @example new Auth(client_id, client_secret)
*/
constructor(client_id, client_secret) {
/**
* @type {TokenFetcher}
*/
this.tokenFetcher = new TokenFetcher(client_id, client_secret)
/**
* @type {ClientCredentialsFlow}
*/
this.clientCredentialsFlow = new ClientCredentialsFlow(this.tokenFetcher)
}
}