Auto Login
AutoLogin is a functionality that enables you to use your Login system and get users validated at Conscent.ai System.
post
{API_URL}/client
/generate-temp-token
A temporary token is generated using an API and this token needs to be stored at Client's end.
You need to pass either the phone number or email of the user from which they have made the purchase.
shell
javaScript
php
Kotlin
csc('auto-login', {
clientId: clientId,
token: tokenEntered,
phone: data?.phoneNumber,
email: data?.email,
successCallbackFunction: async (userDetailsObject: any) => {
setShowLoginDetails(true);
console.log('Success callback received from conscent auto Login', userDetailsObject);
alert('login successfull');
},
errorCallbackFunction: (errorObject: any) => {
console.error(errorObject);
alert('login unsuccessfull');
},
unauthorizedCallback: () => {
console.log('unauthorized callback called');
},
});
csc('auto-login', {
clientId: clientId,
token: tokenEntered,
phone: data?.phoneNumber,
email: data?.email,
successCallbackFunction: async (userDetailsObject: any) => {
setShowLoginDetails(true);
console.log('Success callback received from conscent auto Login', userDetailsObject);
alert('login successfull');
},
errorCallbackFunction: (errorObject: any) => {
console.error(errorObject);
alert('login unsuccessfull');
},
unauthorizedCallback: () => {
console.log('unauthorized callback called');
},
});
csc('auto-login', {
clientId: clientId,
token: tokenEntered,
phone: data?.phoneNumber,
email: data?.email,
successCallbackFunction: async (userDetailsObject: any) => {
setShowLoginDetails(true);
console.log('Success callback received from conscent auto Login', userDetailsObject);
alert('login successfull');
},
errorCallbackFunction: (errorObject: any) => {
console.error(errorObject);
alert('login unsuccessfull');
},
unauthorizedCallback: () => {
console.log('unauthorized callback called');
},
});
ConscentWrapper.INSTANCE?.autoLogin(
phoneNumber = phoneNumber,
email = email,
clientActivity = this@LoginActivity,
tempToken = token
)
- The below code is a callback handler that gives a response in boolean format either true or false.
- True is defined as Login successful.
- False is defined as Login failed.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
Log.i(TAG, "RedirectionHandler.onActivityResult: ")
if (resultCode == RESULT_OK) {
Toast.makeText(applicationContext,"${data?.getStringExtra("STATUS")}",Toast.LENGTH_LONG).show()
}
}
Last modified 1mo ago