Create Token API Examples

JFrog REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

Sample Usage with token

curl -H "Authorization: Bearer <valid access token>" -XPOST "http://localhost:8082/access/api/v1/tokens" -d "scope=applied-permissions/user" 
 
200
{
  "token_id": "<id>"
  "access_token": "<access-token>",
  "refresh_token": "<refresh-token>",  // optional
  "expires_in": "<seconds>",             // optional      
  "scope": "applied-permissions/groups:<group-name>" 
  "scope": "applied-permissions/user",
  "token_type": "access_token"
}

Sample Usage with user credentials

curl -u "login:password" -XPOST "http://localhost:8082/access/api/v1/tokens" -d "scope=applied-permissions/user" 

200
{
  "user_id": "<id>"
  "password": "<password>",
  "refresh_token": "<refresh-token>",  // optional
  "expires_in": "<seconds>",             // optional      
  "scope": "applied-permissions/groups:<group-name>" 
  "scope": "applied-permissions/user",
  "token_type": "access_token"
}

Errors

  • 400 - Invalid input, e.g., expires_invalue is not a number, non-positive number, etc.

  • 401- Unauthenticated

  • 403 - The requested token details are forbidden, e.g.expires_inprovided but is higher than the limit defined by the admin, the user does not have the permissions on the scope he requested, etc.