Previous Topic

Next Topic

OAuth2TokenFromAuthCode - MaxBasic Function

OAuth2TokenFromAuthCode(Client_ID: String, ClientSecret: String, Scope: String, TokenEndPoint: String, AuthEndPoint: String, UsePKCE: Boolean[, QueryString: String]): Object

OAuth2TokenFromAuthCode function returns a JSON OAuth2 token based on parameters passed. If an error occurs, the login form will close and the Response Code, Error and any additional Error Text will be returned as a JSON object.

OAuth2TokenFromAuthCode function accepts an optional QueryString parameter. This can be used to pass additional parameters. When using this function with the IRD, pass the query parameter "logout=true" to ensure the token expires immediately after the session. Multiple parameters can be included in this string by appending with the string "&".

OAuth2TokenFromAuthCode function syntax has these named arguments:

Parameter

Description

Client_ID

Required. The OAuth2 client identifier.

Client Secret

Required. The client secret string.

Scope

Required. The scope of the authorisation.

Token End Point

Required. Web address of the token end point.

Auth End Point

Required. Web address of the authorisation end point.

Use PKCE

Required. When True, the Proof Key for Code Exchange (PKCE) will be used.

Query String

Optional. Send additional query parameters.

Redirect URI

Optional. The redirect URI (if specified) must use protocol http, and host can only be "localhost", or "127.0.01". A port can also be specified, and if specified, must be available, otherwise a randomised port will be used.

Note: This function makes use of an Windows component that wraps Internet Explorer. As such, you may need to modify your Internet Explorer security options depending on the website you are connecting to.

See Also

Web Functions

Book Contents

Book Index