I'm looking for curl sample for getting api_token shown below

curl -v -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
"https://${yourOktaDomain}/api/v1/users?q=eric.johnson@example.com&limit=1"

I already tried OKTA UI but will need eventually to get token value programmatically.
Also, how to understand this “Okta uses a bearer token for API authentication with a sliding scale expiration. Tokens are valid for 30 days and automatically refresh with each API call. Tokens that aren’t used for 30 days expire. The token lifetime is currently fixed and can’t be changed for your organization.”. Let’s say I want to have the sake token for about a year, how can I do that if I use one created using OKTA UI for our organization?
Your help will be greatly appreciated

Thanks

Jeff

Hi @jradom

We do not have an option to create API tokens via API, however you can check out OAuth for Okta API which lets you access API endpoints through bearer tokens.

Regarding your second question, you can do a simple cURL cron request once every 20-30 days in order to use the token (eg. list users on /api/v1/users) and, as such, refresh it.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.