You are reading the documentation for the next version of discord.js. Documentation for v13/v14+ has been moved to old.discordjs.dev

OAuth2API

export declare class OAuth2API
export declare class OAuth2API

No summary provided.

constructor(rest)
Constructs a new instance of the OAuth2API class
NameTypeOptionalDescription
restRESTNoNone
generateAuthorizationURL(options):string
NameTypeOptionalDescription
optionsRESTOAuth2AuthorizationQueryNoThe options for creating the authorization URL
getCurrentAuthorizationInformation(options?):Promise<RESTGetAPIOAuth2CurrentAuthorizationResult>
NameTypeOptionalDescription
optionsPick<RequestData, 'signal'>YesThe options for the current authorization information request
getCurrentBotApplicationInformation(options?):Promise<RESTGetAPIOAuth2CurrentApplicationResult>
NameTypeOptionalDescription
optionsPick<RequestData, 'signal'>YesThe options for the current bot application information request
getToken(body, options?):Promise<RESTOAuth2ImplicitAuthorizationURLFragmentResult>
Fetches the bearer token for the current application
Remarks
This is primarily used for testing purposes
NameTypeOptionalDescription
bodyRESTPostOAuth2ClientCredentialsURLEncodedDataNoThe options for the client credentials grant request
optionsPick<RequestData, 'signal'>YesThe options for the client credentials grant request
refreshToken(body, options?):Promise<RESTPostOAuth2AccessTokenResult>
NameTypeOptionalDescription
bodyRESTPostOAuth2RefreshTokenURLEncodedDataNoThe options for the refresh token request
optionsPick<RequestData, 'signal'>YesThe options for the refresh token request
tokenExchange(body, options?):Promise<RESTPostOAuth2AccessTokenResult>
NameTypeOptionalDescription
bodyRESTPostOAuth2AccessTokenURLEncodedDataNoThe body of the token exchange request
optionsPick<RequestData, 'signal'>YesThe options for the token exchange request