diff --git a/types/simple-oauth2/index.d.ts b/types/simple-oauth2/index.d.ts index b93bbc229f..f5f7659b99 100644 --- a/types/simple-oauth2/index.d.ts +++ b/types/simple-oauth2/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for simple-oauth2 1.1 // Project: https://github.com/lelylan/simple-oauth2 -// Definitions by: [Michael Müller] +// Definitions by: Michael Müller , +// Troy Lamerton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -64,6 +65,7 @@ export type AuthorizationCode = string; export interface AuthorizationTokenConfig { code: AuthorizationCode; redirect_uri: string; + scope?: string | string[]; } export interface PasswordTokenConfig { @@ -71,13 +73,13 @@ export interface PasswordTokenConfig { username: string; /** A string that represents the registered password. */ password: string; - /** A string that represents the application privileges */ - scope: string; + /** A string or array of strings that represents the application privileges */ + scope: string | string[]; } export interface ClientCredentialTokenConfig { /** A string that represents the application privileges */ - scope?: string; + scope?: string | string[]; } export interface OAuthClient { @@ -89,9 +91,9 @@ export interface OAuthClient { authorizeURL(params?: { /** A string that represents the registered application URI where the user is redirected after authentication */ redirect_uri?: string, - /** A String that represents the application privileges */ - scope?: string, - /** A String that represents an option opaque value used by the client to main the state between the request and the callback */ + /** A string or array of strings that represents the application privileges */ + scope?: string | string[], + /** A string that represents an option opaque value used by the client to main the state between the request and the callback */ state?: string }): string, diff --git a/types/simple-oauth2/simple-oauth2-tests.ts b/types/simple-oauth2/simple-oauth2-tests.ts index 713d930f23..f83a616681 100644 --- a/types/simple-oauth2/simple-oauth2-tests.ts +++ b/types/simple-oauth2/simple-oauth2-tests.ts @@ -32,7 +32,8 @@ const oauth2 = oauth2lib.create(credentials); // Get the access token object (the authorization code is given from the previous step). const tokenConfig = { code: '', - redirect_uri: 'http://localhost:3000/callback' + redirect_uri: 'http://localhost:3000/callback', + scope: ['', ''] }; // Callbacks