Skip to content

Commit 1771053

Browse files
Merge pull request lelylan#329 from lelylan/feature/persistent-refresh-tokens-doc-fix
Update persistent refresh token documentation with more accurate details
2 parents 29e4001 + b8af3f8 commit 1771053

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

API.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Creates the authorization URL from the *client configuration* and the *authorize
4848

4949
Additional options will be automatically serialized as query params in the resulting URL.
5050

51-
#### .getToken(params, [httpOptions]) => Promise<AccessToken>
51+
#### await .getToken(params, [httpOptions]) => AccessToken
5252
Get a new access token using the current grant type.
5353

5454
* `params`
@@ -61,12 +61,12 @@ Additional options will be automatically serialized as params for the token requ
6161
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
6262

6363
#### .createToken(token) => AccessToken
64-
Creates a new access token by providing a valid plain token object.
64+
Creates a new access token by providing a token object as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4).
6565

6666
### new ResourceOwnerPassword(options)
6767
This submodule provides support for the OAuth2 [Resource Owner Password Credentials](https://oauth.net/2/grant-types/password/) grant type.
6868

69-
#### .getToken(params, [httpOptions]) => Promise<AccessToken>
69+
#### await .getToken(params, [httpOptions]) => AccessToken
7070
Get a new access token using the current grant type.
7171

7272
* `params`
@@ -79,12 +79,12 @@ Additional options will be automatically serialized as params for the token requ
7979
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
8080

8181
#### .createToken(token) => AccessToken
82-
Creates a new access token by providing a valid plain token object.
82+
Creates a new access token by providing a token object as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4).
8383

8484
### new ClientCredentials(options)
8585
This submodule provides support for the OAuth2 [Client Credentials](https://oauth.net/2/grant-types/client-credentials/) grant type.
8686

87-
#### .getToken(params, [httpOptions]) => Promise<AccessToken>
87+
#### await .getToken(params, [httpOptions]) => AccessToken
8888
Get a new access token using the current grant type.
8989

9090
* `params`
@@ -95,26 +95,26 @@ Additional options will be automatically serialized as params for the token requ
9595
* `httpOptions` All [wreck](https://github.com/hapijs/wreck) options can be overriden as documented by the module `http` options.
9696

9797
#### .createToken(token) => AccessToken
98-
Creates a new access token by providing a valid plain token object.
98+
Creates a new access token by providing a token object as specified by [RFC6750](https://tools.ietf.org/html/rfc6750#section-4).
9999

100100
### AccessToken
101101
#### .expired([expirationWindowSeconds]) => Boolean
102102
Determines if the current access token is definitely expired or not
103103

104104
* `expirationWindowSeconds` Window of time before the actual expiration to refresh the token. Defaults to **0**.
105105

106-
#### .refresh(params) => Promise<AccessToken>
106+
#### await .refresh(params) => AccessToken
107107
Refreshes the current access token. The following params are allowed:
108108

109109
* `params`
110110
* `[scope]` Optional string or array including a subset of the original token scopes to request
111111

112112
Additional options will be automatically serialized as query params for the token request.
113113

114-
#### .revoke(tokenType) => Promise
114+
#### await .revoke(tokenType)
115115
Revokes either the access or refresh token depending on the {tokenType} value. Token type can be one of: `access_token` or `refresh_token`.
116116

117-
#### .revokeAll() => Promise
117+
#### await .revokeAll()
118118
Revokes both the current access and refresh tokens
119119

120120
#### .token

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
22

3+
## Next
4+
### Maintainance
5+
- Documentation updates for persistent access token refresh
6+
37
## 4.1.0
48
### Improvements
5-
- [#398](https://github.com/lelylan/simple-oauth2/pull/328) Add support to refresh persitent access tokens
9+
- [#398](https://github.com/lelylan/simple-oauth2/pull/328) Add support to refresh persistent access tokens
610

711
### Maintainance
812
- [#326](https://github.com/lelylan/simple-oauth2/pull/326) Remove usage of [date-fns](https://date-fns.org/) production dependency

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ async function run() {
184184
run();
185185
```
186186

187-
Once we have determined the access token needs refreshing with the [.expired()](./API.md##expiredexpirationwindowseconds--boolean) method, we can finally refresh it with a [.refresh()](#refreshparams--promiseaccesstoken) method call.
187+
Once we have determined the access token needs refreshing with the [.expired()](./API.md#expiredexpirationwindowseconds--boolean) method, we can finally refresh it with a [.refresh()](./API.md#await-refreshparams--accesstoken) method call.
188188

189189
```javascript
190190
async function run() {

0 commit comments

Comments
 (0)