-->

`Required session does not exist` error while usin

2019-05-17 08:46发布

问题:

I am using REST api of Quickblox. but everytime , i am getting response :

{"errors": {
  "base": ["Required session does not exist"]
}}

And i am using below api : url : http://api.quickblox.com/users.json

Data & header is :

curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cf5709d6013fdb7a6787fbeb8340afed8aec4c69" \
-d '{"user": {"login": "xyz", "password": "xyz@123", "email": "xyz@domain.com", "external_user_id": "68764641", "facebook_id": "87964654", "twitter_id": "132132", "full_name": "test 1234", "phone": "87654351", "website": "", "tag_list": ""}}' \

can anybody help me to resolve this error?

回答1:

When someone connects with an app using QuickBlox, the app has to obtain an access token which provides temporary, secure access to QuickBlox APIs.

A session token is an opaque string that identifies a user and an app.

Session tokens are obtained via Create Session request.

Then, because of privacy checks, all REST API requests must be authenticated with a token - the QB-Token header of each request to REST API must contain valid session token.

Expiration time for session token is 2 hours after last request to REST API. Be aware about it. If you will perform query with expired token - you will receive error 'Required session does not exist'. In this case you have to recreate a session token.

Each REST API response contains header 'QB-Token-ExpirationDate' which contains session token expiration date.