Andrea Giancarli Andrea Giancarli - 1 year ago 152
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 Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download