List token policies

If you need information about your available token policies then all you need to do is call the /{customer_id}/config/tokenPolicies operation. For example, the following Curl command returns information about all the token policies associated with customer 01000000-0000-3000-9000-000000000000:

curl -X GET \
  https://v1.api.us.janrain.com/01000000-0000-3000-9000-000000000000/config/tokenPolicies \
  -H 'Authorization: Bearer 03v-eeodppPrrHXXIx56pRLyDBaOldDxqEwI59MFCFGVuSkLRapzgmfwmEHyKWle'

When you run the preceding command you’ll get back information similar to this for each policy:

{
    "total": 13,
    "_embedded": {
        "tokenPolicies": [
            {
                "id": "002a99a8-f890-4fe0-baa4-e5112b9e3b40",
                "title": "Documentation Token Policy",
                "_links": {
                    "self": {
                        "href": "/01000000-0000-3000-9000-000000000000/config/tokenPolicies/002a99a8-f890-4fe0-baa4-e5112b9e3b40"
                    }
                }
            },
            {

Admittedly, the preceding call doesn’t return a ton of information about any given policy. However, it does return the ID (e.g., 002a99a8-f890-4fe0-baa4-e5112b9e3b40) for each policy, which means you can use that ID and the /{customer_id}/config/tokenPolicies/{token_id} operation to return detailed information about the policy in question:

curl -X GET \
  https://v1.api.us.janrain.com/01000000-0000-3000-9000-000000000000/config/tokenPolicies/03ded1ac-ecdb-4bb6-9c40-6b638757e9fb \
  -H 'Authorization: Basic c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg='

That command returns just about everything you might ever want to know about the policy:

{
    "id": "002a99a8-f890-4fe0-baa4-e5112b9e3b40",
    "accessTokenLifetime": 3600,
    "allowedScopes": [
        "profile",
        "phone"
    ],
    "refreshTokenLifetime": 7776000,
    "title": "Documentation Token Policy",
    "_links": {
        "self": {
            "href": "/01000000-0000-3000-9000-000000000000/config/tokenPolicies/598a1f6a-26dc-47c0-8f72-231e39ba36a7"
        }
    }
}

Did this page help you?