# user login (org)

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /be/v1/login:
    post:
      summary: user login (org)
      deprecated: false
      description: >+
        This endpoint allows a user with valid organization selection token to
        obtain refresh and access tokens for a particular organization. The
        refresh token is valid for 24h by default, access token is valid for 15m
        by default. Expiration times can be changed by providing optional
        parameters within the request body payload.

        Access token is used to grant access to the protected endpoints of the
        ROCKIT Edge API. Refresh token is used to refresh access token. Once
        refresh token is used, it becomes invalid. Subsequent request should use
        new refresh token provided along with refreshed access token.


        On success the endpoint returns ROCKITPLAY Mission Control data,
        information about organization used to login and session data which
        contains refresh and access tokens along with their expiration
        timestamps and the permissions to the individual resources of ROCKIT
        Edge. These are:

        - apps    

        ROCKIT-enabled Apps

        - beUsers 

        Backend users

        - tasks 

        Compute tasks

        - deployments

        ROCKIT-Edge deployment

        - subscriptions

        Webhook/Slack subscription

        - roles

        Roles of Backend users




        If the ROCKIT Edge is working together with ROCKIT StreamInstaller the
        following additional resources are relevant:

        - dependencies
          3rd-party dependencies which should be installed by the ROCKIT StreamInstaller prior to the game start.
        - keys
          Access keys to authenticate CDN downloads.

        The endpoint returns the permissions to each resource, i.e.

        - create
          (apps, beUsers, dependencies, keys)
        - read
          (apps, beUsers, tasks, dependencies, keys)
        - update
          (apps, beUsers, tasks, dependencies, keys)
        - delete
          (apps, beUsers, tasks, dependencies, keys)
        - execute
          (tasks)

      tags:
        - ROCKIT Edge - Backend API/Authentication
      parameters:
        - name: x-rockit-beorgsel-token
          in: header
          description: >-
            Organization selection token obtained from initial user login (user
            + pw) - [`POST
            /be/v1/login`](https://edge.api.cloud.rockitplay.com/user-login-userpw-21568300e0.md).
          required: true
          example: '{{_edge_org_admin_beorgsel_token}}'
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                orgName:
                  type: string
                  description: >-
                    Unique and immutable organization identifier obtained from
                    the ROCKIT Edge administrator.
                  pattern: /^[A-Za-z0-9_]{2,50}$/
                tenant:
                  type: string
                  description: >-
                    Unique and immutable tenant identifier obtained from the
                    ROCKIT Edge administrator.
                sessionExpires:
                  type: integer
                  description: >-
                    Optional parameter to set lifetime of refresh token. Cannot
                    be changed on subsequent refresh requests ([`POST
                    /be/v1/refresh`](https://edge.api.cloud.rockitplay.com/refresh-11630082e0.md)).
                  minimum: 0
                  maximum: 2592000
                tokenExpires:
                  type: integer
                  description: >-
                    Optional parameter to set lifetime of the current access
                    token. Can be changed on subsequent refresh requests ([`POST
                    /be/v1/refresh`](https://edge.api.cloud.rockitplay.com/refresh-11630082e0.md)).
                  minimum: 0
                  maximum: 3600
              required:
                - orgName
                - tenant
              x-apidog-orders:
                - orgName
                - tenant
                - sessionExpires
                - tokenExpires
              x-apidog-ignore-properties: []
            example:
              orgName: '{{EDGE_ORG_NAME}}'
              tenant: '{{EDGE_TENANT_NAME}}'
              sessionExpires: 86400
              tokenExpires: 3600
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      Indicates that the login operation succeeded. A value of
                      "success" confirms that the provided credentials are
                      valid.
                  session:
                    type: object
                    properties:
                      access:
                        type: object
                        properties:
                          token:
                            type: string
                            description: Access token.
                          expires:
                            type: integer
                            description: >-
                              A UNIX timestamp (integer) indicating when the
                              access token will expire.
                        x-apidog-orders:
                          - token
                          - expires
                        description: Contains access token and it's expiration timestamp.
                        required:
                          - token
                          - expires
                        x-apidog-ignore-properties: []
                      id:
                        type: string
                        description: Session ID.
                      refresh:
                        type: object
                        properties:
                          token:
                            type: string
                            description: Refresh token.
                          expires:
                            type: integer
                            description: >-
                              A UNIX timestamp (integer) indicating when the
                              refresh token will expire.
                        x-apidog-orders:
                          - token
                          - expires
                        description: Contains refresh token and it's expiration timestamp.
                        required:
                          - token
                          - expires
                        x-apidog-ignore-properties: []
                      permissions:
                        type: object
                        properties:
                          apps:
                            type: array
                            items:
                              type: string
                              enum:
                                - create
                                - read
                                - update
                                - delete
                              x-apidog-enum:
                                - value: create
                                  name: ''
                                  description: Grant access to `POST /be/v1/apps`.
                                - value: read
                                  name: ''
                                  description: ''
                                - value: update
                                  name: ''
                                  description: ''
                                - value: delete
                                  name: ''
                                  description: ''
                            description: >-
                              Permissions to create, read, update, and delete
                              ROCKIT-enabled applications.
                          beUsers:
                            type: array
                            items:
                              type: string
                            description: Permissions related to managing backend users.
                          dependencies:
                            type: array
                            items:
                              type: string
                            description: Permissions for handling third-party dependencies.
                          keys:
                            type: array
                            items:
                              type: string
                            description: ' Permissions for access key management.'
                          roles:
                            type: array
                            items:
                              type: string
                            description: Permissions for role management.
                          sources:
                            type: array
                            items:
                              type: string
                            description: >-
                              Permissions for operations on source-related
                              resources.
                          users:
                            type: array
                            items:
                              type: string
                            description: Permissions for user management.
                          tasks:
                            type: array
                            items:
                              type: string
                            description: Permissions for managing compute tasks.
                          consumption:
                            type: array
                            items:
                              type: string
                            description: Permissions to read consumption data.
                        required:
                          - apps
                          - beUsers
                          - dependencies
                          - keys
                          - roles
                          - sources
                          - users
                          - tasks
                          - consumption
                        x-apidog-orders:
                          - apps
                          - beUsers
                          - dependencies
                          - keys
                          - roles
                          - sources
                          - users
                          - tasks
                          - consumption
                        description: ' An object detailing the user’s access rights across various resources. It includes arrays for:'
                        x-apidog-ignore-properties: []
                    required:
                      - access
                      - id
                      - refresh
                      - permissions
                    x-apidog-orders:
                      - access
                      - id
                      - refresh
                      - permissions
                    description: 'Contains session details for the logged-in user:'
                    x-apidog-ignore-properties: []
                  org:
                    type: object
                    properties:
                      label:
                        type: string
                        description: The human-readable label of the organization.
                      name:
                        type: string
                        description: >-
                          Unique and immutable organization identifier obtained
                          from the ROCKIT Edge administrator.
                        pattern: /^[A-Za-z0-9_]{2,50}$/
                      rsi:
                        type: boolean
                        description: >-
                          A boolean value indicating the use of the
                          ROCKIT-Streaminstaller.
                      egs:
                        type: boolean
                        description: >-
                          A boolean value indicating the use of the Epic Game
                          Store.
                      gog:
                        type: boolean
                        description: A boolean value indicating the use of the GOG.
                      steam:
                        type: boolean
                        description: A boolean value indicating the use of the Steam.
                    required:
                      - label
                      - name
                      - rsi
                      - egs
                      - gog
                      - steam
                    x-apidog-orders:
                      - label
                      - name
                      - rsi
                      - egs
                      - gog
                      - steam
                    description: 'Contains organization-specific details:'
                    x-apidog-ignore-properties: []
                  profile:
                    type: object
                    properties:
                      firstname:
                        type: string
                        description: First name of the user.
                      secondname:
                        type: string
                        description: Second name of the user.
                    required:
                      - firstname
                      - secondname
                    x-apidog-orders:
                      - firstname
                      - secondname
                    description: 'Provides additional authentication details:'
                    x-apidog-ignore-properties: []
                  clientData:
                    type: object
                    properties:
                      rockit-mc:
                        type: object
                        properties:
                          orgs:
                            type: array
                            items:
                              type: object
                              properties:
                                color:
                                  type: string
                                label:
                                  type: string
                                name:
                                  type: string
                              x-apidog-orders:
                                - color
                                - label
                                - name
                              required:
                                - color
                                - label
                                - name
                              x-apidog-ignore-properties: []
                        x-apidog-orders:
                          - orgs
                        required:
                          - orgs
                        x-apidog-ignore-properties: []
                    x-apidog-orders:
                      - rockit-mc
                    required:
                      - rockit-mc
                    x-apidog-ignore-properties: []
                required:
                  - status
                  - session
                  - org
                  - profile
                  - clientData
                x-apidog-orders:
                  - status
                  - session
                  - org
                  - profile
                  - clientData
                x-apidog-ignore-properties: []
              examples:
                '1':
                  summary: Success
                  value:
                    status: success
                    session:
                      token: eyJhbGci...
                      expires: 1731749654
                      permissions:
                        apps:
                          - create
                          - read
                          - update
                          - delete
                        beUsers:
                          - create
                          - read
                          - update
                          - delete
                        dependencies:
                          - create
                          - read
                          - update
                          - delete
                        keys:
                          - create
                          - read
                          - update
                          - delete
                        roles:
                          - create
                          - read
                          - update
                          - delete
                        subscriptions:
                          - create
                          - read
                          - update
                          - delete
                        users:
                          - create
                          - read
                          - update
                          - delete
                        tasks:
                          - read
                          - delete
                          - execute
                        consumption:
                          - read
                '2':
                  summary: Unauthorized
                  value:
                    status: failed
                    error: unauthorized
                    message: authorization failed
                    detail: invalid login credentials
          headers: {}
          x-apidog-name: OK
        '400':
          description: ''
          content:
            application/json:
              schema:
                title: ''
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      Reflects that the creation failed due to one or more
                      invalid or missing parameters in the request.
                  error:
                    type: string
                    description: Contains an error identifier.  (e.g., "invalid-param")
                  message:
                    type: string
                    description: >-
                      Explains the nature of the invalid input (for example,
                      "name invalid").
                  detail:
                    type: string
                    description: >-
                      Offers further context on the error. (e.g., expected
                      pattern for the organization name)
                x-apidog-orders:
                  - 01JQMCHN2K2KNHBNTNPCDGJCB1
                required:
                  - status
                  - error
                  - message
                  - detail
                x-apidog-refs:
                  01JQMCHN2K2KNHBNTNPCDGJCB1:
                    $ref: '#/components/schemas/Invalid%20Param'
                x-apidog-ignore-properties:
                  - status
                  - error
                  - message
                  - detail
          headers: {}
          x-apidog-name: Invalid Param
        '401':
          description: ''
          content:
            application/json:
              schema:
                title: ''
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      Indicates that the organization creation request was
                      rejected because of authentication problems.
                  error:
                    type: string
                    description: Contains an error identifier. (e.g."unauthorized")
                  message:
                    type: string
                    description: >-
                      Provides details such as "invalid token" to help diagnose
                      the failure.
                x-apidog-orders:
                  - 01JQMCAVDVRFQA8N5ZQHN6Y570
                x-apidog-refs:
                  01JQMCAVDVRFQA8N5ZQHN6Y570:
                    $ref: '#/components/schemas/unauthorized'
                required:
                  - status
                  - error
                  - message
                x-apidog-ignore-properties:
                  - status
                  - error
                  - message
          headers: {}
          x-apidog-name: Unauthorized
      security: []
      x-apidog-folder: ROCKIT Edge - Backend API/Authentication
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/732774/apis/api-11611254-run
components:
  schemas:
    unauthorized:
      type: object
      properties:
        status:
          type: string
          description: >-
            Indicates that the organization creation request was rejected
            because of authentication problems.
        error:
          type: string
          description: Contains an error identifier. (e.g."unauthorized")
        message:
          type: string
          description: >-
            Provides details such as "invalid token" to help diagnose the
            failure.
      required:
        - status
        - error
        - message
      x-apidog-orders:
        - status
        - error
        - message
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Invalid Param:
      type: object
      properties:
        status:
          type: string
          description: >-
            Reflects that the creation failed due to one or more invalid or
            missing parameters in the request.
        error:
          type: string
          description: Contains an error identifier.  (e.g., "invalid-param")
        message:
          type: string
          description: >-
            Explains the nature of the invalid input (for example, "name
            invalid").
        detail:
          type: string
          description: >-
            Offers further context on the error. (e.g., expected pattern for the
            organization name)
      required:
        - status
        - error
        - message
        - detail
      x-apidog-orders:
        - status
        - error
        - message
        - detail
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    Bearer token:
      type: bearer
      scheme: bearer
      description: >-
        Enter your Access Token. You can obtain this by calling the /be/v1/login
        endpoint. Use the Refresh token to get a new Access token when it
        expires.
servers:
  - url: https://Example-Server.com
    description: Default
security: []

```
