On this page

    1. Home
    2. API
    3. API Reference
    4. Auth Code Create

    Auth Code Create

    The code-create endpoint is used to generate a short-lived authentication code. This code can be used to log in to the same network from a different device (e.g., entering a code on a TV or a constrained device) without manually entering full credentials.


    POST /auth/code-create

    Generate a temporary login code for use on other devices.

    Request

    POST /auth/code-create

    Headers:

    {
      "Host": "api.bringyour.com",
      "Authorization": "Bearer YOUR_JWT_TOKEN",
      "Content-Type": "application/json"
    }

    Body:

    {
      "duration_minutes": 10,
      "uses": 1
    }

    Fields

    FieldTypeDescription
    duration_minutesnumberOptional. How long the code remains valid. Defaults to 10 minutes.
    usesintegerOptional. Maximum number of times the code can be redeemed. Defaults to 1.

    Response

    200 Success

    Status: 200 OK Content-Type: application/json

    {
      "auth_code": "string",
      "duration_minutes": 0,
      "uses": 0,
      "error": {
        "auth_code_limit_exceeded": false,
        "message": "string"
      }
    }

    Fields

    FieldTypeDescription
    auth_codestringThe generated alphanumeric login code.
    duration_minutesnumberConfirmed duration of validity.
    usesintegerConfirmed maximum redemption count.
    errorobjectDetails on why the code could not be created.
    error.auth_code_limit_exceededbooleanTrue if the account has too many active pending codes.

    Example

    HTTP Request

    POST /auth/code-create HTTP/1.1
    Host: api.bringyour.com
    Authorization: Bearer YOUR_JWT_TOKEN
    Content-Type: application/json
     
    {
      "duration_minutes": 15,
      "uses": 1
    }

    Successful HTTP Response

    {
      "auth_code": "BY-9876-5432",
      "duration_minutes": 15,
      "uses": 1,
      "error": null
    }


    Powered by Sudoc v2.5.0
    Hide table of contents