new BasicAuthorization()
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 BasicAuthorization() property.
Derives from Authorization.
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). errorCallback
Authorization~authenticateErrorCallback <optional>
Optional callback invoked on failure (deprecated). 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). 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.
-
isTokenValid()
Checks to see if the authorization token is null, undefined, NaN,an empty string (""), 0, or false.
-
Checks to see if the authorization token is null, undefined, NaN,an empty string (""), 0, or false.
Returns:
- Type
- Boolean
-
logout()
Logs out the current user and clears credentials and tokens.
-
Logs out the current user and clears credentials and tokens.
-
refreshToken(successCallback, errorCallback)
For BasicAuth, there is no need to call this function, because the token never expires.
-
For BasicAuth, there is no need to call this function, because the token never expires. 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 Argument Description 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). Returns:
- Type
- Promise.<(NetworkResponse|NetworkResponse)>