<abstract> new Authorization()
Class used to authorize a mobile user against Oracle Mobile Cloud Service.
- Source:
Methods
-
<abstract> authenticate()
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.
- Source:
-
<abstract> 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). errorCallback
Authorization~authenticateErrorCallback <optional>
Optional callback invoked on failure (deprecated). - Source:
-
getAccessToken()
Returns the current access token from user credentials.
-
Returns the current access token from user credentials.
- Source:
Returns:
current access token from user credentials. -
getCurrentUser(successCallback, errorCallback)
Returns the user resource associated with the logged in user.
-
Returns the user resource associated with the logged in user.
Parameters:
Name Type Argument Description successCallback
Authorization~userSuccessCallback <optional>
Optional callback invoked on success (deprecated). errorCallback
Authorization~errorCallback <optional>
Optional callback invoked on failure (deprecated). - Source:
Returns:
- Type
- Promise.<(Authorization~CurrentUserData|NetworkResponse)>
Example
mcs.mobileBackend.authorization.getCurrentUser().then( function(data){ }, function(exception){ }); // returns statusCode, and the user object on successCallback function from the data parameter. { "id": "c9a5fdc5-737d-4e93-b292-d258ba334149", "username": "DwainDRob", "email": "js_sdk@mcs.com", "firstName": "Mobile", "lastName": "User", "properties": {} }
-
<abstract> isTokenValid()
Returns true if the access token returned by the service is still valid.
-
Returns true if the access token returned by the service is still valid.
- Source:
Returns:
- Type
- Boolean
-
<abstract> logout()
Logs out the current user and clears credentials and tokens.
-
Logs out the current user and clears credentials and tokens.
- Source:
-
<abstract> refreshToken(successCallback, errorCallback)
Refreshes the authentication token if it has expired.
-
Refreshes the authentication token if it has expired. The authentication scheme should support refresh.
Parameters:
Name Type Argument Description successCallback
Authorization~authenticateSuccessCallback <optional>
Optional callback invoked on success. errorCallback
Authorization~errorCallback <optional>
Optional callback invoked on failure. - Source:
Type Definitions
-
authenticateErrorCallback(statusCode, message)
Callback invoked on error while authenticating.
-
Callback invoked on error while authenticating.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. message
String The HTTP payload from the server, if available, or an error message. - Source:
-
authenticateErrorCallback(statusCode, message)
Callback invoked on error while authenticating.
-
Callback invoked on error while authenticating.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. message
String The HTTP payload from the server, if available, or an error message. -
authenticateSuccessCallback(statusCode, message)
Callback invoked after successfully authenticating.
-
Callback invoked after successfully authenticating.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. message
String The HTTP payload from the server, if available, or an error message. - Deprecated:
-
- Use promises instead
- Source:
-
authenticateSuccessCallback(statusCode, message)
Callback invoked after successfully authenticating.
-
Callback invoked after successfully authenticating.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. message
String The HTTP payload from the server, if available, or an error message. - Source:
-
authenticateSuccessCallback(statusCode, message)
Callback invoked after successfully authenticating.
-
Callback invoked after successfully authenticating.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. message
String The HTTP payload from the server, if available, or an error message. -
CurrentUserData
Object returned from getCurrentUser().
-
Object returned from getCurrentUser().
- Source:
Properties:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. user
User The user resource returned by the service. -
errorCallback(statusCode, message)
Callback invoked on error while authenticating.
-
Callback invoked on error while authenticating.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. message
String The HTTP payload from the server, if available, or an error message. - Deprecated:
-
- Use promises instead
- Source:
-
userSuccessCallback(statusCode, user)
Callback invoked after downloading or updating a user resource.
-
Callback invoked after downloading or updating a user resource.
Parameters:
Name Type Description statusCode
Number Any HTTP status code returned from the server, if available. user
User The user resource returned by the service. - Source: