question

lior avatar image
lior asked Bryanne Vega answered

CloverAuth.authenticate failed. Got null

Hello, I am trying to authonticate clover in this way:

mAccount = CloverAccount.getAccount(this); //This line work well. CloverAuth.AuthResult authResult = CloverAuth.authenticate(MainActivity.this, mAccount); //Got null...

When I am creating the authontication got null. Why (The reason I need the authontication is because I need the token and baseurl)? Thank you, Lior

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mike M avatar image
Mike M answered

Have you created the app on your Dev Dashboard, uploaded an initial apk, and then installed the apk via the App Market? Only then will an AuthToken exist for your app's packageId on the Clover device. This is currently the same process that is required when permissions for an app have been changed.

Also, if you step into the CloverAuth.authenticate(...) method, you should be able to find the specific error it is logging before returning the null AuthResult.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bryanne Vega avatar image
Bryanne Vega answered
Try:

CloverAuth.authenticate(context, account, true, null, null);
A. Context
B. Account (CloverAccount.getAccount(context))
C. Force Token Validation = takes longer but ensures you have a valid token (recommended)
D. Timeout = true/false/null
F. If timeout, how much can you wait in millis/null

Or try's @Sam 's suggestion...
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community