FORMAT: 1A
HOST: https://passport.thegrid.io/

# The Grid Passport

The Grid Passport is The Grid's account system that is responsible for access control and user account information.
# Group User

## User information [/api/user]

### Get currently authenticated user [GET]

+ Response 200 (application/json)

  + Body

      ```
      <!-- include(examples/user-with-avatar.json) -->
      ```

  + Schema

      ```
      <!-- include(full-schema/user.json) -->
      ```

### Update user information [PUT]

Update the current user's profile information, for example to add missing details. The request payload should be a JSON-encoded object containing the following keys:

+ email (required, string) - new email address for the user
+ name (string) - User's real name

+ Response 200 (application/json)

  User information was successfully updated

  + Body

+ Response 422

  Missing details

  + Body

## Information about other users [/api/user/{id}]

+ Parameters
  + id (required, string) - User UUID

### Get user information [GET]

+ Response 200 (application/json)

  + Body

      ```
      <!-- include(examples/user-without-email.json) -->
      ```

  + Schema

      ```
      <!-- include(full-schema/user.json) -->
      ```

## User's public GitHub Token [/api/user/github]

### Get GitHub token for the authenticated user [GET]

This API call requires the `github` scope.

+ Response 403

  Failed OAuth or missing `github` scope.

  + Body

+ Response 404

  No public GitHub token available

  + Body

+ Response 200 (application/json)

  + Body

      ```
      {
        "username": "grid-bot",
        "token": "nijcoqf3h3287f7g"
      }
      ```

## User's private GitHub Token [/api/user/github_private]

### Get GitHub token for the authenticated user [GET]

This API call requires the `github` scope.

+ Response 403

  Failed OAuth or missing `github` scope.

  + Body

+ Response 404

  No private GitHub token available

  + Body

+ Response 200 (application/json)

  + Body

      ```
      {
        "username": "grid-bot",
        "token": "nijcoqf3h3287f7g"
      }
      ```
