Class: OAuthAuthorization

OAuthAuthorization


new OAuthAuthorization()

Class used to authorize a mobile user against Oracle Mobile Cloud Service.

Class used to authorize a mobile user against Oracle Mobile Cloud Service. Callers should use MobileBackend's authorization property. Derives from Authorization.
Source:

Methods


authenticate(username, password, successCallback, errorCallback)

Authenticates a user with the given credentials against the service.

Authenticates a user with the given credentials against the service. The user remains logged in until logout() is called.
Parameters:
Name Type Argument Description
username String The username of the credentials.
password String The password of the credentials.
successCallback Authorization~authenticateSuccessCallback <optional>
Optional callback invoked on success (deprecated use promises instead).
errorCallback Authorization~authenticateErrorCallback <optional>
Optional callback invoked on failure (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(NetworkResponse|NetworkResponse)>

authenticateAnonymous(successCallback, errorCallback)

Authenticates an anonymous user against the service.

Authenticates an anonymous user against the service. The user remains logged in until logout() is called.
Parameters:
Name Type Argument Description
successCallback Authorization~authenticateSuccessCallback <optional>
Optional callback invoked on success (deprecated use promises instead).
errorCallback Authorization~errorCallback <optional>
Optional callback invoked on failure (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(NetworkResponse|NetworkResponse)>

getAuthorizedUserName()

Returns the username of the current authorized user if any, null otherwise.

Returns the username of the current authorized user if any, null otherwise.
Source:

getClientId()

Returns the client ID for the current backend.

Returns the client ID for the current backend.
Source:

getClientSecret()

Returns the client secret for the current backend.

Returns the client secret for the current backend.
Source:

getTenantName()

Returns the tenant name for the current backend.

Returns the tenant name for the current backend.
Source:

isTokenValid()

Checks to see if the OAuth token is null, undefined, NaN,an empty string (""), 0,or false.

Checks to see if the OAuth token is null, undefined, NaN,an empty string (""), 0,or false. It also checks the timestamp for when the token was first retrieved to see if it was still valid.
Source:
Returns:
Type
Boolean

logout()

Logs out the current user and clears credentials and tokens.

Logs out the current user and clears credentials and tokens.
Source:

refreshToken(successCallback, errorCallback)

For OAuth, the SDK can not refresh because it does not persist client credentials.

For OAuth, the SDK can not refresh because it does not persist client credentials. This function only exists here because it inherits from the Authorization object, which is also used for other types of authentication in which the token can expire.
Parameters:
Name Type Description
successCallback Authorization~authenticateSuccessCallback Optional callback invoked on success (deprecated use promises instead).
errorCallback Authorization~errorCallback Optional callback invoked on failure (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(String|NetworkResponse)>