Authentication
The Authentication Module is responsible for communication to the GK Authentication Service, which creates JWT for further communication through API Gateway. It automatically updates the accessTokens if they are expired.
init
| Request parameters | Type | Description |
|---|---|---|
| context | Context | Context of the application class. Note: Android only |
| baseUrl | String | The base URL for the module. |
| tenantId | String | The tenant identifier for the module. |
| basicAuthUser | String | Authentication user with the service. |
| basicAuthPass | String | Authentication password with the service. |
| timeoutMilliSeconds | Long, Optional | This will overwrite the default timeout
for this module only. It will also overwrite the values which were set in SelfScanningInfo. |
| enableDebug | Bool | Enable logging to console. Note: iOS only |
| ErrorHandling | If a required parameter is missing, init will throw an IllegalArgumentException("$parameter is required and needs to be set."). |
| Android | iOS |
|---|---|
init:
|
init:
|
loginUser
User login into the SDK; request of access data for the customer.
| Request parameters | Type | Description |
|---|---|---|
| username | String | Username of the customer for
login. Note: This value will be stored
internally for later usages. |
| password | String | Password of the customer for login. |
| callback | AuthenticationServiceResponse | Response which contains all needed data
for the authentication of the customer. This data will be stored internally and used inside of the SDK to authenticate the user against the backend. |
| ErrorHandling |
|
refreshToken
Refresh the currently stored access data on SDK side with the newly requested data based on the refreshToken.
| Request parameters | Type | Description |
|---|---|---|
| callback | AuthenticationServiceResponse | Response which contains all updated
data for the authentication of the customer. This data will be stored internally and used inside of the SDK to authenticate the user against the backend. Note: If the
backend returns 401, the user data stored inside of SDK will be
reset automatically. |
| ErrorHandling |
|
getAccessToken
This method internally checks whether the accessToken has already expired or will expire soon (next 30 seconds) and will refresh the accessToken.
| Request parameters | Type | Description |
|---|---|---|
| callback | String | Response which contains the accessToken
of the customer. Note: If the automatic refresh
token returns 401, the user data stored inside the SDK will be
reset automatically → UserNotFoundError
|
| ErrorHandling |
|
getUsername
| Type | Description |
|---|---|
| String | Return the internally stored username from the login. |
reset
This method will remove module-related data from the Customer Profile Service Mobile SDK.
There are two reset methods:
- static method: will remove locally stored data related to the module
- instance method: will also remove the data which is stored inside the instance of the module