Refresh the access and ID tokens (2024)

Identity Engine

This guide shows you how to refresh access and ID tokens by using either the Identity Engine SDK or the OIDC & OAuth 2.0 API.

Learning outcome

  • Understand how access and ID tokens have a limited lifetime.
  • Know how to use refresh tokens when access and ID tokens expire.

What you need

Overview

Access tokens often have limited lifetimes. If you allow access tokens to expire, their usefulness is limited in the event an attacker discovers them. Your app can refresh expired tokens by using a refresh token. The app can then continue using the appropriate resources without user intervention.

All the SDKs expose functionality that allows you to obtain access, ID, and refresh tokens. Each SDK (Swift, JavaScript, and so on) has a different set of methods and functionality that provide built-in support for token refresh, auto-renewal, and storage. Minimally, all the SDKs allow you to obtain the refresh token and call the authorization server's token endpoint to renew the access token.

Refresh the tokens

You can refresh tokens with the SDK or with the OAuth token endpoint.

Refresh the tokens with the SDK

Refresh the tokens with the OAuth token endpoint

You can refresh access and ID tokens using the /token (opens new window) endpoint with the grant_type set to refresh_token. Before calling this endpoint, obtain the refresh token from the SDK and ensure that you've included offline_access as a scope in the SDK configurations. For further details on access token refresh with this endpoint, see Use a refresh token.

Platform-specifc and SPA apps

OIDC and OAuth 2.0 requests for platform-specific and single-page apps (SPAs) don't include the Authorization header with the client ID and secret. Instead, these apps include the client_id query parameter in their requests.

Request example
POST /oauth2/default/v1/token HTTP/1.1Accept: application/jsonContent-Type: application/x-www-form-urlencodedgrant_type=refresh_tokenredirect_uri=com.embeddedauth://callbackscope=offline_access openid profilerefresh_token=03_hBtVj-Hk0Mxo9TPSdl7TLkxQioKqQEzud3ldqHqsclient_id=0oa94el1z4nUDxx0z5d7
Response example
{ "token_type": "Bearer", "expires_in": 3600, "access_token": "eyJraWQiOiJoQkZNR...", "scope": "offline_access openid profile", "refresh_token": "HRzOBfj1A1g6akWqNHfCE-KX-9NASmnFqhRFOt_rEdc", "id_token": "eyJraWQiOiJoQkZN..."}

Use the introspect endpoint to get token info

To get information on a current token, such as if the token is active or has expired, use the /introspect (opens new window) endpoint.

Platform-specific and SPA apps

OIDC and OAuth 2.0 requests for platform-specific and single-page apps (SPAs) don't include the Authorization header with the client ID and secret. Instead, these apps include the client_id query parameter in their requests.

Request example

POST /oauth2/default/v1/introspect HTTP/1.1Accept: application/jsonContent-Type: application/x-www-form-urlencodedtoken=eyJraWQiOiJoQk...client_id=0oa14dl1z4nUJxx0z5d7token_type_hint=access_token

Response example

{ "active": true, "scope": "profile openid offline_access", "username": "foo@bar.com", "exp": 1626128470, "iat": 1626124870, "sub": "foo@bar.com", "aud": "api://default", "iss": "https://dev-12345678.okta.com/oauth2/default", "jti": "AT.4PAhL3RW5Yxn5leKbT3_xpiflVWYvcrKtzgkt9HHwDo.oar2str41LSUbsgXb5d6", "token_type": "Bearer", "client_id": "0oa14dl1z4nUJxx0z5d7", "uid": "00u128itb5sYrGii55d7"}
Refresh the access and ID tokens (2024)
Top Articles
Information Sharing
Chapter 15. Managing GNOME Shell extensions via Command Line
Whas Golf Card
Jail Inquiry | Polk County Sheriff's Office
Poe T4 Aisling
Fort Carson Cif Phone Number
Nfr Daysheet
Collision Masters Fairbanks
Dr Lisa Jones Dvm Married
Calamity Hallowed Ore
Irving Hac
Crusader Kings 3 Workshop
Items/Tm/Hm cheats for Pokemon FireRed on GBA
Degreeworks Sbu
Nashville Predators Wiki
5808 W 110Th St Overland Park Ks 66211 Directions
2021 Lexus IS for sale - Richardson, TX - craigslist
Are They Not Beautiful Wowhead
Download Center | Habasit
How to Create Your Very Own Crossword Puzzle
Craigslistjaxfl
Ruben van Bommel: diepgang en doelgerichtheid als wapens, maar (nog) te weinig rendement
Trivago Sf
Delaware Skip The Games
Conan Exiles Sorcery Guide – How To Learn, Cast & Unlock Spells
Bjerrum difference plots - Big Chemical Encyclopedia
Aol News Weather Entertainment Local Lifestyle
Www.patientnotebook/Atic
Jeff Nippard Push Pull Program Pdf
Paris Immobilier - craigslist
27 Modern Dining Room Ideas You'll Want to Try ASAP
Spectrum Outage in Queens, New York
NV Energy issues outage watch for South Carson City, Genoa and Glenbrook
Login.castlebranch.com
Craigslist Efficiency For Rent Hialeah
Rays Salary Cap
Publix Coral Way And 147
Life Insurance Policies | New York Life
Xfinity Outage Map Lacey Wa
Frostbite Blaster
Eleceed Mangaowl
Puffco Peak 3 Red Flashes
The best Verizon phones for 2024
2020 Can-Am DS 90 X Vs 2020 Honda TRX90X: By the Numbers
Sam's Club Gas Prices Florence Sc
Az Unblocked Games: Complete with ease | airSlate SignNow
Fluffy Jacket Walmart
855-539-4712
Race Deepwoken
Diccionario De Los Sueños Misabueso
The 5 Types of Intimacy Every Healthy Relationship Needs | All Points North
Booked On The Bayou Houma 2023
Latest Posts
Article information

Author: Edwin Metz

Last Updated:

Views: 5824

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Edwin Metz

Birthday: 1997-04-16

Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

Phone: +639107620957

Job: Corporate Banking Technician

Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.