Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

Authenticates the client from specified service with scope and user and returns the authentication result.

boolean myRestClient.Authenticate(service: string)

Authenticates the client from specified service with scope and user and returns the authentication result.

boolean myRestClient.Authenticate(service: string, scope: string)

Authenticates the client from specified service with scope and user and returns the authentication result.

boolean myRestClient.Authenticate(service: string, scope: string, identity: ( string | Identity ))

Arguments

string service
Name of service to authenticate. Can be empty.
string scope
Scope of authentication context.
( string | Identity ) identity
Identity to impersonate

Remarks

If service argument 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.

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 withRestClient.IsAuthenticatedproperty.

Example

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

If service argument 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.

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 withRestClient.IsAuthenticatedproperty.

Example

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

If service argument 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.

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 withRestClient.IsAuthenticatedproperty.

Example

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

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();
  
}
  • No labels