From 56d1a1a8d772718bdd28175b0c0120352487cc95 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Mon, 7 Nov 2016 10:23:36 -0800 Subject: [PATCH] Update token documentation (adding `expiresIn`) --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a499d7..ec602db 100644 --- a/README.md +++ b/README.md @@ -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'