Skip to content

oauthservice

Kevin Wang edited this page Mar 2, 2021 · 4 revisions

OAuth Service

OAuth apps

GET /api/oauth/app/id/:clientid

  • Gets a app config
  • Response: Status 200
{
  "client_id": "<client id>",
  "name": "<app name>",
  "url": "<app url>",
  "redirect_uri": "<app redirect uri>",
  "logo": "<app logo preview>",
  "time": "<last modified time>",
  "creation_time": "<creation time>"
}

GET /api/oauth/app/id/:clientid/image

  • Gets a app logo
  • Response: Status 200
    • image/png

GET /api/oauth/app?amount=<amount>&offset=<offset>

  • Gets all apps
  • Header: Authorization: Bearer <access token>
    • Only accessible by oauth
  • Scope: gov.user.oauth.app:read
  • Response: Status 200
{
  "apps": [
    {
      "client_id": "<client id>",
      "name": "<app name>",
      "url": "<app url>",
      "redirect_uri": "<app redirect uri>",
      "logo": "<app logo preview>",
      "time": "<last modified time>",
      "creation_time": "<creation time>"
    }
  ],
}

GET /api/oauth/app/ids?ids=<comma,separated,ids>

  • Gets apps by ids
  • Response: Status 200
{
  "apps": [
    {
      "client_id": "<client id>",
      "name": "<app name>",
      "url": "<app url>",
      "redirect_uri": "<app redirect uri>",
      "logo": "<app logo preview>",
      "time": "<last modified time>",
      "creation_time": "<creation time>"
    }
  ],
}

POST /api/oauth/app

  • Registers a new app
  • Header: Authorization: Bearer <access token>
    • Only accessible by oauth
  • Scope: gov.user.oauth.app:write
  • Request:
{
  "name": "<app name>",
  "url": "<app url>",
  "redirect_uri": "<app redirect uri>"
}
  • Response: Status 201
{
  "client_id": "<client id>",
  "key": "<client secret>"
}

PUT /api/oauth/app/id/:clientid

  • Modifies an existing app config
  • Header: Authorization: Bearer <access token>
    • Only accessible by oauth
  • Scope: gov.user.oauth.app:write
  • Request:
{
  "name": "<app name>",
  "url": "<app url>",
  "redirect_uri": "<app redirect uri>"
}
  • Response: Status 204

PUT /api/oauth/app/id/:clientid/image

  • Upload an app logo
  • Header: Authorization: Bearer <access token>
    • Only accessible by oauth
  • Scope: gov.user.oauth.app:write
  • Request:
HTML Form multipart/form-data
image: <File(image/png, image/jpeg, image/gif)>
  • Response: Status 204

PUT /api/oauth/app/id/:clientid/rotate

  • Rotates the client secret
  • Header: Authorization: Bearer <access token>
    • Only accessible by oauth
  • Scope: gov.user.oauth.app:write
  • Response: Status 200
{
  "client_id": "<client id>",
  "key": "<client secret>"
}

DELETE /api/oauth/app/id/:clientid

  • Delete an app
  • Header: Authorization: Bearer <access token>
    • Only accessible by oauth
  • Scope: gov.user.oauth.app:write
  • Response: Status 204

OpenID connections

GET /api/oauth/openid-configuration or GET /.well-known/openid-configuration

  • Get well-known OpenID configuration

GET /api/oauth/jwks

  • Get jwks used to sign tokens

GET /api/oauth/auth/code r.Post("/auth/code", m.authCode, gate.User(m.s.gate, scopeAuthorize))

  • Consents to an authorization request for the auth code openid/oauth flow used by oauth authorization screen
  • Header: Authorization: Bearer <access token>
    • Only accessible by user
  • Scope: gov.user.oauth.authorize
  • Request:
{
  "client_id": "<client id>",
  "scope": "<requested space separated scopes>",
  "nonce": "<nonce passed from client>",
  "code_challenge": "<code challenge passed from client>",
  "code_challenge_method": "<code challenge method passed from client>",
}
  • Response: Status 200
{
  "code": "<code>",
}

GET /api/oauth/connection?amount=<amount>&offset=<offset>

  • Gets a user's oauth app connections
  • Header: Authorization: Bearer <access token>
    • Only accessible by user
  • Scope: gov.user.oauth.connection:read
  • Response: Status 200
{
  "connections": [
    {
      "client_id": "<client id>",
      "scope": "<space separated scopes>",
      "auth_time": "<last auth time>",
      "access_time": "<last accessed time>",
      "creation_time": "<time of first grant>",
    },
  ],
}

GET /api/oauth/connection/id/{id}

  • Gets a user's oauth app connection
  • Header: Authorization: Bearer <access token>
    • Only accessible by user
  • Scope: gov.user.oauth.connection:read
  • Response: Status 200
{
  "client_id": "<client id>",
  "scope": "<space separated scopes>",
  "auth_time": "<last auth time>",
  "access_time": "<last accessed time>",
  "creation_time": "<time of first grant>",
}

DELETE /api/oauth/connection/id/{id}

  • Deletes a user's oauth app connection
  • Header: Authorization: Bearer <access token>
    • Only accessible by user
  • Scope: gov.user.oauth.connection:write
  • Response: Status 204
Clone this wiki locally