Back to top

The Grid Passport

The Grid Passport is The Grid’s account system that is responsible for access control and user account information.

User

User information

Get currently authenticated user
GET/api/user

Example URI

GET https://passport.thegrid.io//api/user
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "0d1fbca0-ee3c-4157-9881-b03db3e462b9",
  "email": "[email protected]",
  "name": "Example User",
  "avatar": "http://example.net/user.png"
}
Schema
{
  "id": "user.json",
  "$schema": "http://json-schema.org/draft-04/schema",
  "title": "User",
  "description": "User profile",
  "type": [
    "object"
  ],
  "properties": {
    "id": {
      "description": "Unique identifier",
      "format": "uuid",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "example": "01234567-89ab-cdef-0123-456789abcdef",
      "type": "string"
    },
    "email": {
      "type": "string",
      "example": "[email protected]"
    },
    "name": {
      "type": "string",
      "example": "Example User"
    },
    "avatar": {
      "$ref\"": "base.json#/definitions/url"
    },
    "founder": {
      "example": 6,
      "description": "Founding member number",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer"
        }
      ]
    },
    "scope": {
      "description": "Usage scopes granted to the user",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "example": "content_management"
      }
    },
    "app": {
      "description": "Unique identifier",
      "format": "uuid",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "example": "01234567-89ab-cdef-0123-456789abcdef",
      "type": "string"
    },
    "plan": {
      "description": "Unique identifier",
      "format": "uuid",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "example": "01234567-89ab-cdef-0123-456789abcdef",
      "type": "string"
    },
    "quotaSites": {
      "example": 1,
      "description": "How many sites the user is allowed to create",
      "type": "integer"
    },
    "canUse": {
      "description": "Feature flagging based on user plan",
      "type": "object",
      "properties": {
        "siteMediaCta": {
          "description": "If user can create CTA in the site header",
          "type": "boolean"
        },
        "edCta": {
          "description": "If user can create CTA in Ed",
          "type": "boolean"
        },
        "edEmbed": {
          "description": "If user can create embedded block in Ed",
          "type": "boolean"
        }
      }
    },
    "activatedAt": {
      "description": "When the user plan was activated",
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name"
  ]
}

Update user information
PUT/api/user

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

Example URI

PUT https://passport.thegrid.io//api/user
Response  200
HideShow

User information was successfully updated

Headers
Content-Type: application/json
Response  422
HideShow

Missing details

Information about other users

Get user information
GET/api/user/{id}

Example URI

GET https://passport.thegrid.io//api/user/id
URI Parameters
HideShow
id
string (required) 

User UUID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "0d1fbca0-ee3c-4157-9881-b03db3e462b9",
  "name": "Example User",
  "avatar": "http://example.net/user.png"
}
Schema
{
  "id": "user.json",
  "$schema": "http://json-schema.org/draft-04/schema",
  "title": "User",
  "description": "User profile",
  "type": [
    "object"
  ],
  "properties": {
    "id": {
      "description": "Unique identifier",
      "format": "uuid",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "example": "01234567-89ab-cdef-0123-456789abcdef",
      "type": "string"
    },
    "email": {
      "type": "string",
      "example": "[email protected]"
    },
    "name": {
      "type": "string",
      "example": "Example User"
    },
    "avatar": {
      "$ref\"": "base.json#/definitions/url"
    },
    "founder": {
      "example": 6,
      "description": "Founding member number",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer"
        }
      ]
    },
    "scope": {
      "description": "Usage scopes granted to the user",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "example": "content_management"
      }
    },
    "app": {
      "description": "Unique identifier",
      "format": "uuid",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "example": "01234567-89ab-cdef-0123-456789abcdef",
      "type": "string"
    },
    "plan": {
      "description": "Unique identifier",
      "format": "uuid",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "example": "01234567-89ab-cdef-0123-456789abcdef",
      "type": "string"
    },
    "quotaSites": {
      "example": 1,
      "description": "How many sites the user is allowed to create",
      "type": "integer"
    },
    "canUse": {
      "description": "Feature flagging based on user plan",
      "type": "object",
      "properties": {
        "siteMediaCta": {
          "description": "If user can create CTA in the site header",
          "type": "boolean"
        },
        "edCta": {
          "description": "If user can create CTA in Ed",
          "type": "boolean"
        },
        "edEmbed": {
          "description": "If user can create embedded block in Ed",
          "type": "boolean"
        }
      }
    },
    "activatedAt": {
      "description": "When the user plan was activated",
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name"
  ]
}

User's public GitHub Token

Get GitHub token for the authenticated user
GET/api/user/github

This API call requires the github scope.

Example URI

GET https://passport.thegrid.io//api/user/github
Response  403
HideShow

Failed OAuth or missing github scope.

Response  404
HideShow

No public GitHub token available

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "username": "grid-bot",
  "token": "nijcoqf3h3287f7g"
}

User's private GitHub Token

Get GitHub token for the authenticated user
GET/api/user/github_private

This API call requires the github scope.

Example URI

GET https://passport.thegrid.io//api/user/github_private
Response  403
HideShow

Failed OAuth or missing github scope.

Response  404
HideShow

No private GitHub token available

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "username": "grid-bot",
  "token": "nijcoqf3h3287f7g"
}

Generated by aglio on 07 Feb 2017