mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
add scope(s) to authorization code flow (#25096)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
6b7871531f
commit
38c005479f
Vendored
+9
-7
@@ -1,6 +1,7 @@
|
||||
// Type definitions for simple-oauth2 1.1
|
||||
// Project: https://github.com/lelylan/simple-oauth2
|
||||
// Definitions by: [Michael Müller] <https://github.com/mad-mike>
|
||||
// Definitions by: Michael Müller <https://github.com/mad-mike>,
|
||||
// Troy Lamerton <https://github.com/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,
|
||||
|
||||
|
||||
@@ -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: '<code>',
|
||||
redirect_uri: 'http://localhost:3000/callback'
|
||||
redirect_uri: 'http://localhost:3000/callback',
|
||||
scope: ['<scope1>', '<scope2>']
|
||||
};
|
||||
|
||||
// Callbacks
|
||||
|
||||
Reference in New Issue
Block a user