RhinoCommon API
IRhinoAccountsManagerGetAuthTokensAsync Method (String, String, SecretKey, CancellationToken) |
Asynchronously retrieves auth tokens with the given criteria from the Rhino Accounts server.
Namespace: Rhino.Runtime.RhinoAccounts
Assembly: RhinoCommon (in RhinoCommon.dll)
Since: 7.0
Task<Tuple<IOpenIDConnectToken, IOAuth2Token>> GetAuthTokensAsync( string clientId, string clientSecret, SecretKey secretKey, CancellationToken cancellationToken )
Function GetAuthTokensAsync ( clientId As String, clientSecret As String, secretKey As SecretKey, cancellationToken As CancellationToken ) As Task(Of Tuple(Of IOpenIDConnectToken, IOAuth2Token))
Parameters
- clientId
- Type: SystemString
The unique id of the client registered in Rhino Accounts. - clientSecret
- Type: SystemString
The secret of the client registered in Rhino Accounts - secretKey
- Type: Rhino.Runtime.RhinoAccountsSecretKey
A special key that was handed to you in ExecuteProtectedCodeAsync(FuncSecretKey, Task) - cancellationToken
- Type: System.ThreadingCancellationToken
A token that can be used to signal that the operation should be cancelled.
Return Value
Type: TaskTupleIOpenIDConnectToken, IOAuth2TokenThe auth tokens requested.
| Exception | Condition |
|---|---|
| InvalidOperationException | An invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager |
| RhinoAccountsException | An error occurred during the authentication process. You may look at the specific subclass of the exception gain more insight as to why the operation failed. |
| OperationCanceledException | The operation was cancelled, either by internal decisions or because the cancellationToken was cancelled. |
This method includes a default scope of 'openid', 'email', 'profile', and 'groups'. It should be suffifient for most workflows. This method shows the user a UI showing them the progress of the operation, and allows them to cancel it at any time.
It also stores the retrieved tokens in a secure cache so they can be retrieved in the future by calling TryGetAuthTokens(String, SecretKey)