Auth0 Playground

Test project to show how auth0 can be used for authorization and authentification:

  • Login
  • Authentification with bearer token
  • Authorization with user's scopes

Quickstart guide to Auth0 account setup

ManagementApi (Server/Machine-To-Machine)

  1. Create Test App (Machine-To-Machine) image

  2. Create test user

  3. Generate client token: POST https://{domain}/oauth/token

{
    "client_id":"***",
    "client_secret":"***",
    "audience":"https://{domain}/api/v2/",
    "grant_type":"client_credentials"
}

Audience can be found in Api (API Identifier) that is used by the application: image

image

Client id and secret can be found on Settings tab of the application image

  1. Get test user data with generated token GET https://{domain}/api/v2/users/{user_id}

Authentication Api (Client)

  1. Create Client Api and set audience as Identifier: image

  2. Set default audience in Tenant Settings: image

Password

  1. Configure client to allow password grant-type 1.1 Settings -> Advanced Settings image

1.2 Dashboard -> Settings -> Api Authorization Settings set Username-Password-Authentication in Default Directory image

  1. Create token for a user that was created before:

POST https://{domain}/oauth/token

{
    "client_id":"***",
    "grant_type":"password",
    "username": "***",
    "password": "***"
}

Playground: Post /login

To make this endpoint public (usable by third parties who know only client_id) set application setting "Token Endpoint Authentication Method" to None image

Note: Access to application with this settings can not authenticated with client credentials.

  1. Check token by getting info

Playground: Get /info

Permissions

  1. Add scopes to Client Api image

  2. Set permissions to user: image

  3. Create token and see scopes in this token: image