Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Retrieving an Access Token from Fabric.Identity

John Parsons edited this page Dec 10, 2018 · 6 revisions

Retrieving an Access Token from Fabric.Identity

Retrieving access tokens is a fundamental part of integrating with Fabric services or non-Fabric services that are protected by Fabric.Identity. During development, testing, and resource registration, you will need an access token to perform operations.

For example, to register an application with Fabric.Identity, you will need an access token with the proper scope (fabric/identity.manageresources) to create your client or API resource.

Below is the CatalystDosIdentity command to retrieve an access token with the appropriate scopes to create clients:

Get-AccessToken -identityUrl https://{fabric-identity-url} -clientId "fabric-installer" -scope "fabric/identity.manageresources" -secret {installer_secret}

Below is the curl command to retrieve an access token with the appropriate scopes to create clients:

curl https://{fabric-identity-url}/connect/token --data "client_id=fabric-installer&grant_type=client_credentials&scope=fabric/identity.manageresources" --data-urlencode "client_secret={installer_secret}"

Below is a command that works in Powershell demonstrating how to retrieve an access token with the appropriate scopes to create clients:

$body = @{
        client_id     = "fabric-installer"
        grant_type    = "client_credentials"
        scope         = "fabric/identity.manageresources"
        client_secret = "{installer_secret}"
        }

$response = Invoke-RestMethod -Method Post -Uri https://{fabric-identity-url}/connect/token -Body $body
$json = $response | ConvertTo-Json
$json

Clone this wiki locally