Create a Project App
To create access tokens that allow access to the resources of a particular project only, Playfix allows you to create apps. Each app has a title and a unique access token that allows access to the resources of a specific project only.
Create an app.
POST
https://api.playfix.io/auth/apps
Headers
Authorization*
String
The account-level access token.
Bearer <your_access_token>
Request Body
active*
String
The activity status of the app. Set this to true
to make the app active.
title*
String
A title for the app.
{
"name": "apps/01gkyp46dan6ma35gysz0mwddf",
"title": "Moonar",
"privateKey": "a00ef67a01ddfd13e61392ee6d8e280983d94c42cf14cff930a8b697296ba4da",
"active": true
Example cURL Call
curl --request POST \
--url 'https://api.playfix.io/auth/apps' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"title": "Moonar",
"active": true
}'
Example Python Call
import requests
import json
payload = {
"title": "moonar",
"active": true
}
r = requests.post(
"https://api.playfix.io/auth/apps",
headers = {
"Authorization": "Bearer <your_access_token>",
"Accept": "application/json",
"Content-Type": "application/json"
},
data = json.dumps(payload)
)
print(r.text)
Request Body
title
- A title for the app.active
- The activity status of the app. Set this totrue
to make the app active.
Response
{
"name": "apps/01gkyp46dan6ma35gysz0mwddf",
"title": "Moonar",
"privateKey": "a00ef67a01ddfd13e61392ee6d8e280983d94c42cf14cff930a8b697296ba4da",
"active": true
}
Response Fields
name
- A unique name of the app. This begins with apps/ followed by a ULID.privateKey
- A secret key that allows you to request an access token in the next step.
Get App Access Token
To get an access key for an app, send a POST request to the /auth/accounts
path, calling the :signInIdentity
method.
Example cURL Call
curl --request POST \
--url 'https://api.playfix.io/auth/accounts:signinIdentity' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"privateKey": {
"name": "<app_name>",
"privateKey": "<app_private_key>"
}
}'
Example Python Call
import requests
import json
payload = {
"privateKey": {
"name": "app_name",
"privateKey": "app_private_key"
}
}
r = requests.post(
"https://api.playfix.io/auth/accounts:signinIdentity",
headers = {
"Authorization": "Bearer <your_access_token>",
"Accept": "application/json",
"Content-Type": "application/json"
},
data = json.dumps(payload)
)
print(r.text)
Response
{
"accessToken": "01gm431efymcb6tj8q4qgtkgdp",
"app": {
"name": "apps/01gm41105kf8f2fpt72ajs820g",
"title": "Moonar",
"privateKey": "",
"active": true
}
}
Response Field
accessToken
- The project-level access token for the application. You can use this to authorize API requests for the associated project.
Last updated