Comment on page
API and Authentication
Idis the base64-encoded version of the
databaseIdwith the ObjectType.
In other words,
For example, if the
databaseIdfor a recipe is b78a8f0d-4c89-4df1-bc73-42e2175e2737 then its iD would be UmVjaXBlOmI3OGE4ZjBkLTRjODktNGRmMS1iYzczLTQyZTIxNzVlMjczNw==
In Python, this would be done as follows:
databaseIDto execute some of the queries and mutations. The
databaseIDparameter is the base64-encoded version of the ID of an element that can be either of a user or a recipe.
For that reason, use the
databaseIdto send it as a
sg-userparameter in the header.
"Authorization": "Token replace_user_token",
sg-userfor all the queries that are executed on behalf of a user. For example:
Using it in the header:
- If you need to get the list of all users created with a specific token, it is only required to send the token parameter because we don't require to get the information of a specific user.
- If you need to generate a meal plan, it is required to send the
databaseIDin the header since it will be generated for a specific user.
Use it in a mutation:
Use the ID when you The ID is the base64-encoded version of the
databaseId. Use this ID to send it as a parameter within a query or a mutation.
Some common examples:
The JWT authentication is intended to be used on the client-side while the API token authentication must be only used on the server-side.
Partners/clients which have an isolated database will need to authenticate by using a different HTTP header named