Andrea Giancarli Andrea Giancarli - 1 month ago 9
Android Question

Quickblox Initialize framework from token cause crash

I'm trying to Initialize the quickblox android framework.

The documentation say

It's also possible to initialize the SDK with an existent QuickBlox token. It can be interesting in cases when you build a big system and you have a custom server side which generates QuickBlox tokens
.
This is what i want to do because, for security reason, I don't want to keep AUTH_SECRET and AUTH_KEY in my app code.

But when i do

BaseService.createFromExistentToken(token, expirationDate);


i get
java.lang.RuntimeException: applicationId is null. You must call QBSettings.getInstance().init(Context, String, String, String) before using the QuickBlox library.


It look a bit contradictory to me.

I generated the token server-side and it is not expired

Can anyone point me to the right direction?

Is it possible to log-in user in quickblox without AUTH_SECRET and AUTH_KEY stored in the app?

Answer

I'm posting here the solution based on QB support team's response to my ticket.

To initialize QB

QBSettings.getInstance().init(getContext(), APP_ID, "", "")

Then I can initialize SDKs using my existent token and it's expiration date:

BaseService tokenService = QBAuth.createFromExistentToken(TOKEN, date);
Comments