Generate a user token.

Details

Generate a user token.

The user ID must be explicitly specified using the ecosystem ID which contains that user.
The following token expiration types are valid:

  1. Infinite: A token that never expires.
  2. FixedTtl: A token that expires after a set amount of time (“fixed time to live”).
  3. SlidingTtl: A token that expires after a set amount of time from the last time it was used (“sliding time to live”). Using the token within the allotted time resets the amount of time it is valid.

An account token or server token may be used to run this endpoint.

Parameters

path

  • ecosystemId (required): The ID of the ecosystem.
  • id (required): The unique ID of a user.

query

  • expiryType (optional): The manner in which a generated user token should expire. Default is “FixedTtl.”
  • ttl (optional): The time that a generated user token will be valid, in seconds. Default is 3600.

Responses

200

{
    "token": "USER-TOKEN"
}

400

  • Query Field Not Allowed: The standard error structure defines this error as invalid parameters, with additional parameters in the query string. In this context, it means that one or more query string fields are incorrect. They do not match the name(s) of the query string field(s) that are allowed for this endpoint.
  • Token Duration Invalid: This error means that the token duration given was invalid, and the standard error structure lists this as invalid parameters. Token duration should be listed as a positive number of seconds.
  • Token Expiration Type Invalid: This error means that the type of token expiration type given was invalid, and the standard error structure lists this as invalid parameters.
  • User Invalid: The standard error structure defines this error as invalid parameters, with an invalid ID. In this context, it means that the ID of the user given was not valid.

404

  • Ecosystem Not Found: This error means that an ecosystem with the given ID was not found. This is distinct from an invalid ecosystem ID being specified; this means that the ecosystem ID once existed, but no longer does.
  • User Not Found: This error means that user with the given ID was not found.

Examples

HTTP

POST https://ioe.droplit.io/api/users/ECOSYSTEM-ID;USER-ID/tokens HTTP/1.1
authorization: TOKEN

Droplit Console

droplit user create-token USER-ID

Droplit SDK

droplit.users.createToken("ECOSYSTEM-ID", "USER-ID", TTL, "EXPIRY-TYPE");

🚧

WARNING

When using the SDK, ALL fields are required to be provided.

Language
Authorization
Header
Click Try It! to start a request and see the response here!