Skip to main content

Authentication

Studio API Authentication

The Studio API routes are secured and only accessible with a given JWT user token provided from the authentication service of the API. This ensures, that only registered and authorized users can access the API core resources.

JSON Web Tokens (JWT)

Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services, and resources that are permitted with that token. JSON Web Tokens are a good way of securely transmitting information between parties.

HTTP Header

To authenticate a user, a client application must send a JSON Web Token JWT in the authorization header of the HTTP request to Studio backend API. Studio API validates the token on behalf of your API, so you don't have to add any code in your API to process the authentication.

HTTPS

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

How to get JWS Token

info

If you are a new user, get your token calling the REGISTER route, or, if you are a registered user, get your token calling the LOGIN route.

If you are a NEW USER, get your token calling the REGISTER route.

curl -L -X POST 'https://api.deepopinion.ai/auth/register' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"password": "badpassword"
}'

How to add JWS Token in Http Header for authenticate next routes

Adding Token in HTTP header

With the Successful response from Login or Register routes, you have the auth_token.

Now, to authenticate via bearer auth (e.g., for a cross-origin request), use

-H "Authorization: Bearer  eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NzU5MDE2MzcsInN1YiI6MjQxNjAyLCJpc3MiOiJkZWVwb3Bpbmlvbi5haSIsImxhbmd1YWdlcyI6WyIqIl0sImZ1bmN0aW9uYWxpdHkiOlsiQW5hbHlzaXMvKiIsIlRyYWluaW5nLyoiLCJNb2RlbHMvKiJdLCJpYXQiOjE2NzQ2OTIwMzd9.b9pAeNbstZzhWa7vWrP9PgMGSUbFsPkfyLjlZIwDlO4ufL0b5QsyRN2lUTqFp55yDs0zI4rXTqn1FsV9GE5uujEUqHAzh5Y9-ibk5WypuSefN_YUDOdceCSegrC1ScgnT9OKdR1a-f0sP4u2rd8PZmUZLPigTTbJdLJX-Ljm3lOgO0p6Goy0WpbqZ_KZJF9UHI9MPKUhkfrn6aKyB1s-z9yIUz6GLTGHCJCtWqTkshy42dG26EMsf3an-MkuzsXA_x2maI7BzRWkDkl8-VyL_aSOTLHacwF62PFeyYtvCy8Cslz6OiX4LcOXKSwwYt9jz9073uqoBhcuyemX-x2fB2sF4Fe7VqFPCsRqIT2TOtyD9cz-e7zpjSOEtUtc1uavOx4mOLdrOa64BfpKPtcUPRUhwXdVF0-LFDVToykf-nf2uq3jsiJemYvAdymuT-pzwNWXPIC0UmlxLJZyneEIVXn90s2ibbeRC-ilz4uN159OGWy66ZL5ZP019q9nCzVGKCCDJ4ezS5g3TJIqf9NJM8ZyHOb5NeAQbta22jHeKd7oz0dfdUepZdC8zAeTtrLyPnCs032EuuqIjs4ZJ5yr3SrRIk12XB2bps1SxcSxfBftrqlyitbWlKbO3u5LDM99WMnBDleS1NQe-58z8nPdCeyZ79WesNf3je8thDxgJ1w"

instead of -u {auth_token} in your next calls.

Example Get models user is authorized to see.

curl -L -X GET 'https://api.deepopinion.ai/models' \
-H 'Accept: application/json' \
-H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NzU5MDE2MzcsInN1YiI6MjQxNjAyLCJpc3MiOiJkZWVwb3Bpbmlvbi5haSIsImxhbmd1YWdlcyI6WyIqIl0sImZ1bmN0aW9uYWxpdHkiOlsiQW5hbHlzaXMvKiIsIlRyYWluaW5nLyoiLCJNb2RlbHMvKiJdLCJpYXQiOjE2NzQ2OTIwMzd9.b9pAeNbstZzhWa7vWrP9PgMGSUbFsPkfyLjlZIwDlO4ufL0b5QsyRN2lUTqFp55yDs0zI4rXTqn1FsV9GE5uujEUqHAzh5Y9-ibk5WypuSefN_YUDOdceCSegrC1ScgnT9OKdR1a-f0sP4u2rd8PZmUZLPigTTbJdLJX-Ljm3lOgO0p6Goy0WpbqZ_KZJF9UHI9MPKUhkfrn6aKyB1s-z9yIUz6GLTGHCJCtWqTkshy42dG26EMsf3an-MkuzsXA_x2maI7BzRWkDkl8-VyL_aSOTLHacwF62PFeyYtvCy8Cslz6OiX4LcOXKSwwYt9jz9073uqoBhcuyemX-x2fB2sF4Fe7VqFPCsRqIT2TOtyD9cz-e7zpjSOEtUtc1uavOx4mOLdrOa64BfpKPtcUPRUhwXdVF0-LFDVToykf-nf2uq3jsiJemYvAdymuT-pzwNWXPIC0UmlxLJZyneEIVXn90s2ibbeRC-ilz4uN159OGWy66ZL5ZP019q9nCzVGKCCDJ4ezS5g3TJIqf9NJM8ZyHOb5NeAQbta22jHeKd7oz0dfdUepZdC8zAeTtrLyPnCs032EuuqIjs4ZJ5yr3SrRIk12XB2bps1SxcSxfBftrqlyitbWlKbO3u5LDM99WMnBDleS1NQe-58z8nPdCeyZ79WesNf3je8thDxgJ1w'