Automating Token Retrieval: A Scripted Solution Using Existing Service
Author: |
Sheila Albertelli |
Created at: |
Jan 2025 |
Updated at: |
Jan 2025 |
https://docs.pingidentity.com/pingoneaic//latest/tenants/service-accounts.html
Custom Script - gettokent.sh - Upload to Git Hub
While creating service accounts is straightforward, efficiently leveraging them for token management can simplify workflows and eliminate unnecessary dependencies on tenant admin tokens.
This article builds upon
A
Scripted Approach for Creating and Using Service Accounts in ForgeRock
Identity Cloud, which explains how to create service accounts. My
script, gettoken.sh, takes it a step further by enabling you to use an
existing service account to retrieve and assign tokens as needed—all
without requiring repeated input of a tenant admin token.
With this solution, you’ll only need to perform a one-time setup. Once
configured, you can run the script (. ./gettoken.sh) as many times as
needed, streamlining token retrieval for your workflows.
This article, A Scripted Approach for Creating and Using Service Accounts in ForgeRock Identity Cloud talks about how to create the service account, my script will use the account created above and get token and assign token based on needs.
In order to execute and for segregation of duties reasons the script
must be executed with a Tenant Admin user’s access token. For example:
The above old article will help to create a service account, but the
issue with the script is that it will need you to provide tenant admin
token. My script will not need it; all you need is to set it up one
time, and you can run it multiple times after the first setup is done.
my script will be run as . ./gettoken.sh and you will get token needed
They need to run below
./service_accounts.sh eyJ0eXAiOiJKV...
Download the script:
-
gettokent.sh (899 Bytes)