Recipes
Create application session
1. Set your Application ID
Get the application_id
from the Dashboard => YOUR_APP => Overview section . curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730"
}' \
https://api.quickblox.com/session.json
2. Set your Authorization Key
Get the auth_key
from the Dashboard => YOUR_APP => Overview section . curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
}' \
https://api.quickblox.com/session.json
3. Set a timestamp
Get a timestamp
value in the Unix Timestamp. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
}' \
https://api.quickblox.com/session.json
4. Set a nonce
Set a nonce
value which is a unique random number that can’t be sent twice. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7334",
}' \
https://api.quickblox.com/session.json
5. Set a signature
Generate a signature
value. Use this guide to learn how to generate a signature. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7334",
"signature":"e6e603c251a569e70a2f27a8c71b5017e81e05d5"
}' \
https://api.quickblox.com/session.json
6. As a result, the API returns a newly created application session.
1. Set your Application ID
Get the application_id
from the Dashboard => YOUR_APP => Overview section . curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730"
}' \
https://api.quickblox.com/session.json
2. Set your Authorization Key
Get the auth_key
from the Dashboard => YOUR_APP => Overview section . curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"gqneCwWtz8dqF4F",
}' \
https://api.quickblox.com/session.json
3. Set a timestamp
Get a timestamp
value in the Unix Timestamp. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349717",
}' \
https://api.quickblox.com/session.json
4. Set a nonce
Set a nonce
value which is a unique random number that can’t be sent twice. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7497",
}' \
https://api.quickblox.com/session.json
5. Set a signature
Generate a signature
value. Use this guide to learn how to generate a signature. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7334",
"signature":"1924a2c84b96347d66b6b2c8489a3cf1d35a8d74",
}' \
https://api.quickblox.com/session.json
6. Set a login of the user
Set a login
value to identify a user on the server. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7334",
"signature":"1924a2c84b96347d66b6b2c8489a3cf1d35a8d74",
"user":{
"login":"Mike",
}
}' \
https://api.quickblox.com/session.json
7. Set a password of the user
Set a password
value to identify a user on the server. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7334",
"signature":"1924a2c84b96347d66b6b2c8489a3cf1d35a8d74",
"user":{
"login":"Mike",
"password":"!mike123"
}
}' \
https://api.quickblox.com/session.json
8. As a result, the API returns a newly created user session.
Create session with Firebase phone number
1. Set your Application ID
Get the application_id
from the Dashboard => YOUR_APP => Overview section . curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"71116",
}' \
https://api.quickblox.com/session.json
2. Set your Authorization Key
Get the auth_key
from the Dashboard => YOUR_APP => Overview section . curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"RTydVt3ktSV3mpK",
}' \
https://api.quickblox.com/session.json
3. Set a Firebase user ID token
Set a Firebase user ID token using the firebase_phone[access_token]
. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"firebase_phone[access_token]":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3MTBiMDE3ZmQ5YjcxMWUwMDljNmMzNmIwNzNiOGE2N2NiNjgyMTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcXVldWUtZGVtby1jbGllbnQiLCJhdWQiOiJxdWV1ZS1kZW1vLWNsaWVudCIsImF1dGhfdGltZSI6MTYyNjQzMjg5OSwidXNlcl9pZCI6InFhZnNjMHpnOHNVSktvdFJkb1J1eUx1UXdiRjMiLCJzdWIiOiJxYWZzYzB6ZzhzVUpLb3RSZG9SdXlMdVF3YkYzIiwiaWF0IjoxNjI2NDMyOTAwLCJleHAiOjE2MjY0MzY1MDAsInBob25lX251bWJlciI6IiszODA5Mzc2MzcyNTMiLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBob25lIjpbIiszODA5Mzc2MzcyNTMiXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.ORDJTSGTicsvAeJ-eUQcDvt5Jv-y1c3HteOlzLApTZZ2C-nJZOB4RFpvoviIQwH53PFANB5iXTHBw1a5XBKROeRYEyu8YLg6RsH0wt5f5_hzGsUisgeFleDrz9i3V7NqkITqz2ADcJrWzwF-YDj5TbzCTlHmgeciiuViVbLqyFSKfyYrvFjM7x1IvJYUNVD3XGIq33128eaqHRuWfiaW5PC9ZdvfdOF5UhNpBx330TfM1FV9gNBQxd3cmxCE-bD1kvHQWLk6z8XKTNWZag718_Gf7MVmhqk-bC_KtwQ7IGVMRjPgCdNbA8H1btIcofD2iUVtzTew4et7leR6ujCAcA",
}' \
https://api.quickblox.com/session.json
4. Set an ID of the Firebase project
Set an ID of the Firebase project using the firebase_phone[project_id]
. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"firebase_phone[access_token]":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3MTBiMDE3ZmQ5YjcxMWUwMDljNmMzNmIwNzNiOGE2N2NiNjgyMTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcXVldWUtZGVtby1jbGllbnQiLCJhdWQiOiJxdWV1ZS1kZW1vLWNsaWVudCIsImF1dGhfdGltZSI6MTYyNjQzMjg5OSwidXNlcl9pZCI6InFhZnNjMHpnOHNVSktvdFJkb1J1eUx1UXdiRjMiLCJzdWIiOiJxYWZzYzB6ZzhzVUpLb3RSZG9SdXlMdVF3YkYzIiwiaWF0IjoxNjI2NDMyOTAwLCJleHAiOjE2MjY0MzY1MDAsInBob25lX251bWJlciI6IiszODA5Mzc2MzcyNTMiLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBob25lIjpbIiszODA5Mzc2MzcyNTMiXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.ORDJTSGTicsvAeJ-eUQcDvt5Jv-y1c3HteOlzLApTZZ2C-nJZOB4RFpvoviIQwH53PFANB5iXTHBw1a5XBKROeRYEyu8YLg6RsH0wt5f5_hzGsUisgeFleDrz9i3V7NqkITqz2ADcJrWzwF-YDj5TbzCTlHmgeciiuViVbLqyFSKfyYrvFjM7x1IvJYUNVD3XGIq33128eaqHRuWfiaW5PC9ZdvfdOF5UhNpBx330TfM1FV9gNBQxd3cmxCE-bD1kvHQWLk6z8XKTNWZag718_Gf7MVmhqk-bC_KtwQ7IGVMRjPgCdNbA8H1btIcofD2iUVtzTew4et7leR6ujCAcA",
"firebase_phone[project_id]:"33444545",
}' \
https://api.quickblox.com/session.json
5. Set a nonce
Set a nonce
value which is a unique random number that can’t be sent twice. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"firebase_phone[access_token]":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3MTBiMDE3ZmQ5YjcxMWUwMDljNmMzNmIwNzNiOGE2N2NiNjgyMTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcXVldWUtZGVtby1jbGllbnQiLCJhdWQiOiJxdWV1ZS1kZW1vLWNsaWVudCIsImF1dGhfdGltZSI6MTYyNjQzMjg5OSwidXNlcl9pZCI6InFhZnNjMHpnOHNVSktvdFJkb1J1eUx1UXdiRjMiLCJzdWIiOiJxYWZzYzB6ZzhzVUpLb3RSZG9SdXlMdVF3YkYzIiwiaWF0IjoxNjI2NDMyOTAwLCJleHAiOjE2MjY0MzY1MDAsInBob25lX251bWJlciI6IiszODA5Mzc2MzcyNTMiLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBob25lIjpbIiszODA5Mzc2MzcyNTMiXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.ORDJTSGTicsvAeJ-eUQcDvt5Jv-y1c3HteOlzLApTZZ2C-nJZOB4RFpvoviIQwH53PFANB5iXTHBw1a5XBKROeRYEyu8YLg6RsH0wt5f5_hzGsUisgeFleDrz9i3V7NqkITqz2ADcJrWzwF-YDj5TbzCTlHmgeciiuViVbLqyFSKfyYrvFjM7x1IvJYUNVD3XGIq33128eaqHRuWfiaW5PC9ZdvfdOF5UhNpBx330TfM1FV9gNBQxd3cmxCE-bD1kvHQWLk6z8XKTNWZag718_Gf7MVmhqk-bC_KtwQ7IGVMRjPgCdNbA8H1btIcofD2iUVtzTew4et7leR6ujCAcA",
"firebase_phone[project_id]:"33444545",
"nonce":"9823",
}' \
https://api.quickblox.com/session.json
6. Set a social network provider
Use a provider
param to set a social network provider. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"firebase_phone[access_token]":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3MTBiMDE3ZmQ5YjcxMWUwMDljNmMzNmIwNzNiOGE2N2NiNjgyMTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcXVldWUtZGVtby1jbGllbnQiLCJhdWQiOiJxdWV1ZS1kZW1vLWNsaWVudCIsImF1dGhfdGltZSI6MTYyNjQzMjg5OSwidXNlcl9pZCI6InFhZnNjMHpnOHNVSktvdFJkb1J1eUx1UXdiRjMiLCJzdWIiOiJxYWZzYzB6ZzhzVUpLb3RSZG9SdXlMdVF3YkYzIiwiaWF0IjoxNjI2NDMyOTAwLCJleHAiOjE2MjY0MzY1MDAsInBob25lX251bWJlciI6IiszODA5Mzc2MzcyNTMiLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBob25lIjpbIiszODA5Mzc2MzcyNTMiXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.ORDJTSGTicsvAeJ-eUQcDvt5Jv-y1c3HteOlzLApTZZ2C-nJZOB4RFpvoviIQwH53PFANB5iXTHBw1a5XBKROeRYEyu8YLg6RsH0wt5f5_hzGsUisgeFleDrz9i3V7NqkITqz2ADcJrWzwF-YDj5TbzCTlHmgeciiuViVbLqyFSKfyYrvFjM7x1IvJYUNVD3XGIq33128eaqHRuWfiaW5PC9ZdvfdOF5UhNpBx330TfM1FV9gNBQxd3cmxCE-bD1kvHQWLk6z8XKTNWZag718_Gf7MVmhqk-bC_KtwQ7IGVMRjPgCdNbA8H1btIcofD2iUVtzTew4et7leR6ujCAcA",
"firebase_phone[project_id]:"33444545",
"nonce":"9823",
"provider":"firebase_phone",
}' \
https://api.quickblox.com/session.json
7. Set a signature
Generate a signature
value. Use this guide to learn how to generate a signature. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"firebase_phone[access_token]":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3MTBiMDE3ZmQ5YjcxMWUwMDljNmMzNmIwNzNiOGE2N2NiNjgyMTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcXVldWUtZGVtby1jbGllbnQiLCJhdWQiOiJxdWV1ZS1kZW1vLWNsaWVudCIsImF1dGhfdGltZSI6MTYyNjQzMjg5OSwidXNlcl9pZCI6InFhZnNjMHpnOHNVSktvdFJkb1J1eUx1UXdiRjMiLCJzdWIiOiJxYWZzYzB6ZzhzVUpLb3RSZG9SdXlMdVF3YkYzIiwiaWF0IjoxNjI2NDMyOTAwLCJleHAiOjE2MjY0MzY1MDAsInBob25lX251bWJlciI6IiszODA5Mzc2MzcyNTMiLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBob25lIjpbIiszODA5Mzc2MzcyNTMiXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.ORDJTSGTicsvAeJ-eUQcDvt5Jv-y1c3HteOlzLApTZZ2C-nJZOB4RFpvoviIQwH53PFANB5iXTHBw1a5XBKROeRYEyu8YLg6RsH0wt5f5_hzGsUisgeFleDrz9i3V7NqkITqz2ADcJrWzwF-YDj5TbzCTlHmgeciiuViVbLqyFSKfyYrvFjM7x1IvJYUNVD3XGIq33128eaqHRuWfiaW5PC9ZdvfdOF5UhNpBx330TfM1FV9gNBQxd3cmxCE-bD1kvHQWLk6z8XKTNWZag718_Gf7MVmhqk-bC_KtwQ7IGVMRjPgCdNbA8H1btIcofD2iUVtzTew4et7leR6ujCAcA",
"firebase_phone[project_id]:"33444545",
"nonce":"9823",
"provider":"firebase_phone",
"signature":"5277a30edf002d59318ecec2cf3ab17c4bbd3bee",
}' \
https://api.quickblox.com/session.json
8. Set a timestamp
Get a timestamp
value in the Unix Timestamp. curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"firebase_phone[access_token]":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc3MTBiMDE3ZmQ5YjcxMWUwMDljNmMzNmIwNzNiOGE2N2NiNjgyMTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vcXVldWUtZGVtby1jbGllbnQiLCJhdWQiOiJxdWV1ZS1kZW1vLWNsaWVudCIsImF1dGhfdGltZSI6MTYyNjQzMjg5OSwidXNlcl9pZCI6InFhZnNjMHpnOHNVSktvdFJkb1J1eUx1UXdiRjMiLCJzdWIiOiJxYWZzYzB6ZzhzVUpLb3RSZG9SdXlMdVF3YkYzIiwiaWF0IjoxNjI2NDMyOTAwLCJleHAiOjE2MjY0MzY1MDAsInBob25lX251bWJlciI6IiszODA5Mzc2MzcyNTMiLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7InBob25lIjpbIiszODA5Mzc2MzcyNTMiXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwaG9uZSJ9fQ.ORDJTSGTicsvAeJ-eUQcDvt5Jv-y1c3HteOlzLApTZZ2C-nJZOB4RFpvoviIQwH53PFANB5iXTHBw1a5XBKROeRYEyu8YLg6RsH0wt5f5_hzGsUisgeFleDrz9i3V7NqkITqz2ADcJrWzwF-YDj5TbzCTlHmgeciiuViVbLqyFSKfyYrvFjM7x1IvJYUNVD3XGIq33128eaqHRuWfiaW5PC9ZdvfdOF5UhNpBx330TfM1FV9gNBQxd3cmxCE-bD1kvHQWLk6z8XKTNWZag718_Gf7MVmhqk-bC_KtwQ7IGVMRjPgCdNbA8H1btIcofD2iUVtzTew4et7leR6ujCAcA",
"firebase_phone[project_id]:"33444545",
"nonce":"9823",
"provider":"firebase_phone",
"signature":"5277a30edf002d59318ecec2cf3ab17c4bbd3bee",
"timestamp":"1626433392"
}' \
https://api.quickblox.com/session.json
9. As a result, the API returns a newly created user session.
Learn more about QuickBlox session token in the Application vs User session token section.
Application session
To create an application session you need to pass the required parameters only .
User session
To create a user session you need to pass extra parameters together with the required parameters. Take a look at five types of user authentication and their respective extra parameters below:
Login and password. user[login]
and user[password]
.
Email and password. user[email]
and user[password]
.
Social. provider=facebook
, keys[token]
, and keys[secret]
.
Firebase phone number. provider=firebase_phone
, firebase_phone[project_id]
, and firebase_phone[access_token]
.
Custom identity provider. user[login]
and user[password]
. Learn more about custom identity provider authentication from our guide .
Body Parameters
Unix Timestamp. It should not differ from the time provided by NTP more than 60 minutes. We suggest you synchronize time on your devices with NTP service.
Unique Random Value. Requests with the same timestamp and same value for nonce parameter can not be sent twice.
Possible values: facebook, firebase_phone
Social network provider access token.
Social network provider access token secret.
A unique identifier for your Firebase project.
Firebase user’s ID token.
Responses
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"application_id":"76730",
"auth_key":"7quWEh-k6TqghXe",
"timestamp":"1567349756",
"nonce":"7334",
"signature":"e6e603c251a569e70a2f27a8c71b5017e81e05d5"
}' \
https://api.quickblox.com/session.json
{
"session" : {
"application_id" : 76730 ,
"created_at" : "2019-09-01T14:55:56Z" ,
"id" : 1151827623 ,
"nonce" : 7334 ,
"token" : "c56f382b402fb482086db956064592d3cd012bba" ,
"ts" : 1567349756 ,
"updated_at" : "2019-09-01T14:55:56Z" ,
"user_id" : 0 ,
"_id" : "1151827623"
}
}