Usage

User pages

Return URL

Return URL is used to return user back to an application (main site) after performing needed actions at authorization server, e.g. after logging in or changing password.

Return URL can be provided in two different ways:

Swagger/OpenAPI specification

OpenAPI specification is available:

OAuth2 entry points

Example Grafana configuration:

client_id = grafana
client_secret = ***
scopes = email profile
auth_url = https://hiam.hipanel.com/oauth/authorize
token_url = https://hiam.hipanel.com/oauth/token
api_url = https://hiam.hipanel.com/userinfo

Authorization code request

Authorization code request uses standard OAuth2 parameters:

Prefer signup

When it is known that users to be sent to authorization are new then nonempty prefer_signup GET parameter can be added to authorization code request. Then nonauthorized users will be redirected to signup page instead of login.

Access token request

Access token request uses standard OAuth2 parameters:

Access token response provides standard fields:

and user_attributes payload:

{
    "access_token": "4fb0a78633fd7781b6fb645ed5ba908c1810ee81",
    "expires_in": 86400,
    "refresh_token": "adb631f49614ea5f1d1c1d704053d16fde7951b8",
    "scope": null,
    "token_type": "Bearer",
    "user_attributes": {
        "id": 1234567,
        "username": "jsmith",
        "email": "john@smith.me",
        "email_confirmed": "john@smith.me",
        "type": "client",
        "state": "ok",
        "first_name": "John",
        "last_name": "Smith",
        "verified": "1"
    }
}

User info request

User info request must provide HTTP Authorization Bearer header with token.

Example request:

GET https://hiam.hipanel.com/userinfo
Authorization: Bearer be2911ab56ffedf74da3090b0bb1b0a56d07c5b9

Example response for email scope:

{
  "email": "sol@hiqdev.com",
  "email_confirmed": "sol@hiqdev.com",
  "sub": "1000361"
}

Available grant types

The authorization server provides all standard grant types:

OAuth2 Requests Demo

There is built-in demo where you can try out OAuth2 requests. Demo is available at /demo page. Forms are prefetched with reasonable defaults.

Notification callbacks

Applications can register notification callbacks which will be called on user change events such as user modified, user deleted, user logged out.

Registered callbacks will be called with HTTP POST request with parameters: