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

Commit

Permalink
Update token documentation (adding expiresIn)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Nov 7, 2016
1 parent fb56bed commit 56d1a1a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ To re-create an access token instance and make requests on behalf on the user, y
// Can also just pass the raw `data` object in place of an argument.
var token = githubAuth.createToken('access token', 'optional refresh token', 'optional token type', { data: 'raw user data' })

// Refresh the users credentials and save the updated access token.
// Set the token TTL.
token.expiresIn(1234) // Seconds.
token.expiresIn(new Date('2016-11-08')) // Date.

// Refresh the users credentials and save the new access token and info.
token.refresh().then(storeNewToken)

// Sign a standard HTTP request object, updating URL with token or authorization headers.
// Sign a standard HTTP request object, updating the URL with the access token
// or adding authorization headers, depending on token type.
token.sign({
method: 'get',
url: 'https://api.github.com/users'
Expand Down

0 comments on commit 56d1a1a

Please sign in to comment.