Overview
boolean RestClientmyRestClient.Authenticate(service: string)
boolean RestClientmyRestClient.Authenticate(service: string, scope: string)
boolean RestClientmyRestClient.Authenticate(service: string, scope: string, identity: ( string | Identity ))
...
Remarks
Scope If service argument is based on service parameter and may change to following request's security context. Please refer the service documentation.
Identity is Id number of identity or Identity instance.
This method tries to server-to-server authentication if configured on service, otherwise user consent must be previously given.
Authentication result can be queried with RestClient.IsAuthenticated property.
Example
Code Block | ||
---|---|---|
| ||
var scopes = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email';
var client = $Rest.Create('https://www.googleapis.com/oauth2/v2/userinfo');
if ( client.Authenticate('Google',scopes, $Initiator) ) {
var userInfo = client.ExecuteJson();
} |
...
empty, client is authenticated with HTTP basic credentials from domain settings.
Scope argument is based on service parameter and may change to following request's security context. Please refer the service documentation.
...
Authentication result can be queried with RestClient.IsAuthenticated property.
Example
Code Block | ||
---|---|---|
| ||
var scopes = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'; var client = $Rest.Create('https://www.googleapis.com/oauth2/v2/userinfo'); if ( client.Authenticate('Google',scopes, $Initiator) ) { var userInfo = client.ExecuteJson(); } |
Remarks
Scope argument is based on service parameter and may change to following request's security context. Please refer the service documentation.
Identity is Id number of identity or Identity instance.
This method tries to server-to-server authentication if configured on service, otherwise user consent must be previously given.
Authentication result can be queried with RestClient.IsAuthenticated property.
Example
Code Block | ||
---|---|---|
| ||
var scopes = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email';
var client = $Rest.Create('https://www.googleapis.com/oauth2/v2/userinfo');
if ( client.Authenticate('Google',scopes, $Initiator) ) {
var userInfo = client.ExecuteJson();
} |
Examples
...
language | js |
---|
...