Skip to content

Commit 7d2f632

Browse files
justinedelsonmacdonst
authored andcommittedAug 28, 2019
Update README to clarify the response object from the auth function
1 parent 48274cc commit 7d2f632

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed
 

‎README.md

+20-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Promise based example:
3232
const auth = require('@adobe/jwt-auth');
3333

3434
auth(config)
35-
.then(token => console.log(token))
35+
.then(tokenResponse => console.log(tokenResponse))
3636
.catch(error => console.log(error));
3737
```
3838

@@ -41,8 +41,17 @@ Async/Await based example:
4141
```javascript
4242
const auth = require('@adobe/jwt-auth');
4343

44-
let token = await auth(config);
45-
console.log(token);
44+
let tokenResponse = await auth(config);
45+
console.log(tokenResponse);
46+
```
47+
48+
or (if you don't care about the other properties in the token response)
49+
50+
```javascript
51+
const auth = require('@adobe/jwt-auth');
52+
53+
let { access_token } = await auth(config);
54+
console.log(access_token);
4655
```
4756

4857
#### Config object
@@ -96,6 +105,14 @@ const config = {
96105

97106
This is the recommended approach.
98107

108+
#### Response Object
109+
110+
The response object contains three keys:
111+
112+
* `token_type`
113+
* `access_token`
114+
* `expires_in`
115+
99116
#### Example
100117

101118
```javascript

0 commit comments

Comments
 (0)
Please sign in to comment.