EnsureAuthenticated¶
Authenticates the client with the specified service if not already authenticated.
1 | |
Authenticates the client with the specified service and scope if not already authenticated.
1 | |
Authenticates the client with the specified service, scope, and identity if not already authenticated.
1 | |
Parameters¶
string service optional
The name of the service to authenticate with.
string scope
The scope of the authentication context.
( string | Identity | null ) identity
The identity to impersonate, as an Identity object or its ID.
Returns¶
The current RestClient instance.
Remarks¶
If authentication fails, an error is thrown, so the following calls can assume an authenticated client.
The scope of authentication is based on the service parameter. Refer to the service documentation for details.
This method attempts server-to-server authentication if configured for the service. Otherwise, user consent must have been previously granted.
Examples¶
Authenticate and call a service in one chain¶
1 2 3 4 5 6 | |