OAuth2TokenFromRefreshToken(Client_ID: String, ClientSecret: String, Scope: String, TokenEndPoint: String, RefreshToken: String [, Options: StringList]): Object
OAuth2TokenFromRefreshToken returns a JSON OAuth2 token based on the parameters passed. If an error occurs, the returned JSON contains error, responsecode and errorcode properties instead of a token.
OAuth2TokenFromRefreshToken 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. |
Refresh Token |
Required. The refresh token previously issued by the OAuth2 provider. |
Options |
Optional. A StringList of name/value pairs that are appended to the token request as additional form parameters. Use this to supply extras the token endpoint requires — for example, an otpcode for providers (such as the Accredo Web Service) that enforce two-factor authentication when refreshing a token. |
Example — refreshing a token with an OTP code
Dim opts As Object
opts = NewStringList
opts.Add("otpcode=123456")
Dim token As Object
token = OAuth2TokenFromRefreshToken( _
"my-client-id", _
"my-client-secret", _
"accredo.api", _
"https://example.accredo.co.nz/oauth2/token", _
sStoredRefreshToken, _
opts)
If token.error <> "" Then
Message "Refresh failed (" & token.responsecode & "/" & token.errorcode & "): " & token.error
End If