Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

Commit 56d1a1a

Browse files
committed
Update token documentation (adding expiresIn)
1 parent fb56bed commit 56d1a1a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,15 @@ To re-create an access token instance and make requests on behalf on the user, y
5454
// Can also just pass the raw `data` object in place of an argument.
5555
var token = githubAuth.createToken('access token', 'optional refresh token', 'optional token type', { data: 'raw user data' })
5656

57-
// Refresh the users credentials and save the updated access token.
57+
// Set the token TTL.
58+
token.expiresIn(1234) // Seconds.
59+
token.expiresIn(new Date('2016-11-08')) // Date.
60+
61+
// Refresh the users credentials and save the new access token and info.
5862
token.refresh().then(storeNewToken)
5963

60-
// Sign a standard HTTP request object, updating URL with token or authorization headers.
64+
// Sign a standard HTTP request object, updating the URL with the access token
65+
// or adding authorization headers, depending on token type.
6166
token.sign({
6267
method: 'get',
6368
url: 'https://api.github.com/users'

0 commit comments

Comments
 (0)