MCSAuthorization
Class used to authorize a mobile user against Oracle Mobile Cloud Enterprise.
Callers should use MobileBackend's authorization property.
Extends
Members
isAuthorized :Boolean
Returns true if a user has been authorized, false otherwise. A user can be authorized by calling authenticate() or authenticateAnonymous().
Type:
- Boolean
- Inherited From:
- Source:
Methods
getAccessToken() → {String}
Returns the current access token from user credentials.
- Inherited From:
- Source:
Returns:
current access token from user credentials.
- Type
- String
getAuthorizedUserName() → {String}
Returns the username of the current authorized user if any, null otherwise.
Returns:
- Type
- String
getCurrentUser() → {Promise.<(MCSAuthorization~CurrentUserData|NetworkResponse)>}
Returns the user resource associated with the logged in user.
Returns:
- Type
- Promise.<(MCSAuthorization~CurrentUserData|NetworkResponse)>
Examples
mcs.mobileBackend.authorization.getCurrentUser().then(
function(data){
},
function(exception){
});
// Response example
{
"id": "c9a5fdc5-737d-4e93-b292-d258ba334149",
"username": "DwainDRob",
"email": "js_sdk@mcs.com",
"firstName": "Mobile",
"lastName": "User",
"properties": {}
}
onAuthentication(callback)
Subscribe for on authentication event
Parameters:
Name | Type | Description |
---|---|---|
callback |
Authorization~OnAuthenticationCallback | The callback that will be called when authentication happen. |
- Inherited From:
- Source:
Type Definitions
CurrentUserData
Object returned from getCurrentUser().
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. |