/auth/token
endpoint¶
The /auth/token
endpoint accepts a set of base64-encoded DropStream credentials (username and password, delimited by a colon).
If the credentials are valid, the API responds with a JWT (JSON Web Token). This ephemeral token is required to authorize subsequent requests to other endpoints.
Generate¶
To generate a new JWT, make a POST
request to /auth/token
, providing a base64-encoded USER:PASS
string in an Authorization: Basic
header.
For the payload, provide { "grant_type" : "client_credentials" }
.
Endpoint | /auth/token |
---|---|
Method | POST |
Headers |
|
Payload | { "grant_type" : "client_credentials" } |
Sucess status | HTTP 200 |
Response | { "access_token" : {JWT}, "token_type" : "Bearer" } |
Example
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization:Basic $(echo -n $USER:$PASS | base64)" \
https://api.getdropstream.com/auth/token -d @- <<EOF
{ "grant_type" : "client_credentials" }
EOF
Response:
{
"access_token":"eyJ0eXAiOiJ...cgDhA0-m_XTg",
"token_type":"Bearer"
}
HTTP/1.1 200 OK