Authenticate a user
After a successful registration you would probably need to authenticate your user by using the registration email and password, so you will need to call:
1
private var listener: MBAuthApiAuthenticateListener
2
private var email, password: String
3
4
MBurgerAuthTasks.authenticateUser(applicationContext,
5
listener, //Listener for authentication
6
email, //Email of the user
7
password); //Password of the user
Copied!
This method will return the jwt_token that will automatically be used in all subsequent calls until the app is uninstalled or the user is logged out in order to authenticate all API calls.
It will be automatically stored encrypted within your application, but if you need to save it for your purposes you can obtain it through the listener or with the “action” mode inside the returned bundle with the key MBApiPayloadKeys.key_jwt_token.
If you wish to logout a user just callJava
1
MBurgerAuthTasks.clearAuthToken(applicationContext);
Copied!
Make sure that your app UI will respond to the “logout” in a significative way.
Copy link