Skip to content

Commit 9abea66

Browse files
authored
fixes #198 - change bearer to Bearer to match spec (#208)
1 parent e8df9dc commit 9abea66

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ This fastify plugin adds 3 utility decorators to your fastify instance using the
225225
- `getAccessTokenFromAuthorizationCodeFlow(request, callback)`: A function that uses the Authorization code flow to fetch an OAuth2 token using the data in the last request of the flow. If the callback is not passed it will return a promise. The callback call or promise resolution returns an [AccessToken](https://github.com/lelylan/simple-oauth2/blob/master/API.md#accesstoken) object, which has an `AccessToken.token` property with the following keys:
226226
- `access_token`
227227
- `refresh_token` (optional, only if the `offline scope` was originally requested, as seen in the callbackUriParams example)
228-
- `token_type` (generally `'bearer'`)
228+
- `token_type` (generally `'Bearer'`)
229229
- `expires_in` (number of seconds for the token to expire, e.g. `240000`)
230230
- `getNewAccessTokenUsingRefreshToken(Token, params, callback)`: A function that takes a `AccessToken`-Object as `Token` and retrieves a new `AccessToken`-Object. This is generally useful with background processing workers to re-issue a new AccessToken when the previous AccessToken has expired. The `params` argument is optional and it is an object that can be used to pass in additional parameters to the refresh request (e.g. a stricter set of scopes). If the callback is not passed this function will return a Promise. The object resulting from the callback call or the resolved Promise is a new `AccessToken` object (see above). Example of how you would use it for `name:googleOAuth2`:
231231
```js

test/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ function makeRequests (t, fastify) {
2727
const RESPONSE_BODY = {
2828
access_token: 'my-access-token',
2929
refresh_token: 'my-refresh-token',
30-
token_type: 'bearer',
30+
token_type: 'Bearer',
3131
expires_in: '240000'
3232
}
3333

3434
const RESPONSE_BODY_REFRESHED = {
3535
access_token: 'my-access-token-refreshed',
3636
refresh_token: 'my-refresh-token-refreshed',
37-
token_type: 'bearer',
37+
token_type: 'Bearer',
3838
expires_in: '240000'
3939
}
4040

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ declare namespace fastifyOauth2 {
3232
}
3333

3434
export interface Token {
35-
token_type: 'bearer';
35+
token_type: 'Bearer';
3636
access_token: string;
3737
refresh_token?: string;
3838
id_token?: string;

0 commit comments

Comments
 (0)