Knowledgebase: QB Assistance
I receive “Token is required” error?
Posted by on 31 January 2014 09:57 AM

I receive “Token is required” error, why?

 

The error means that you are trying to perform a query without creating a session first.


To create session use the following:

QBAuth.createSession(new QBCallbackImpl() {
            @Override
            public void onComplete(Result result) {
                if (result.isSuccess()) {
                    // do other requests here
                    //
                } else {
                    handleErrors(result);
                }
            }
        });

 

You can also try checking your token for null:

try {
    String token = BaseService.getBaseService().getToken();
    if(token == null){
        // recreate session here
    }
} catch (BaseServiceException e) {
    e.printStackTrace();
}

 

If for some reason it is null, recreate the session.

 

 

(14 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: