Ucommerce
  • Ucommerce Next Gen
    • Getting Started
      • Prerequisites
      • Licensing
      • Ucommerce Templates
      • Headless Template
      • MVC Template
    • Headless
      • Postman Collection
      • Headless API Authentication
        • Token endpoint - Authorization Header
        • Authorization Scopes
        • Refreshing the Access Token
      • Reference
        • Cart
        • Cart / Order Line Items
        • Shipment
        • Billing
        • Promotion Codes
        • Price Groups
        • Payment Methods
        • Countries
        • Shipping Methods
        • Catalogs
        • Cart Custom Properties
        • Line Item Custom Properties
        • Orders
        • Views for Cart modifying operations
      • Custom Headless APIs
      • Error Handling
      • Pagination
      • Deprecation
    • Backoffice Authentication
      • Microsoft Entra ID Example
      • Auth0 Authentication Example
    • Definitions
      • What is a Definition
    • Search and indexing
      • Configuration
      • Indexing
        • Index Definitions
        • Facets
        • Indexing Prices
        • Suggestions
        • Custom Data
      • Searching
    • Payment Providers
      • Stripe Provider Integration
      • Implementing a custom payment provider
    • Data Import
    • Miscellaneous
      • Media
      • Price Group Inheritance
      • Price Group Criteria
      • Soft Deletion Of Entities
      • Logging
      • OpenTelemetry
    • Extensions
      • Extending Pipelines
        • Order Processing Pipelines
        • Checkout Pipelines
      • Changing Service Behavior
        • Images
        • Content
      • Custom Headless APIs
      • Extend the Backoffice
        • Custom UI Components
      • Custom Editor UI
      • Custom Promotion Criteria
      • Custom Price Group Criteria
    • How-To
      • Migrate from Classic
        • Common database issues
      • Entities from code
        • Bootstrapping data on startup
        • Product Definitions & Fields
      • Discover pipelines and their tasks
      • Executing a pipeline
    • Integrations
      • Umbraco Media Delivery API
      • App Slices
        • Product Picker
  • Release Notes
  • Contact Us
Powered by GitBook
On this page

Was this helpful?

  1. Ucommerce Next Gen
  2. Headless
  3. Headless API Authentication

Refreshing the Access Token

Access tokens expire in 5 minutes after generation. Once it expires, the refresh_token can be used to refresh it. Refresh tokens are valid for 90 days.

curl -D- -X POST <base_url>/api/v1/oauth/token \
    -u <CLIENT_ID>:<CLIENT_SECRET> \
    -H 'Content-Type: application/json'  \
    -d '{
            "grant_type" : "refresh_token",
            "refresh_token" : "<refresh_token>"
        }'

An example of a valid response:

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI797234J9.eyJ1c2VySWQiOiJmYTE4OTI3MS1mOTY1LTRmNWMtOTlmOS1lNDViNzNiYzI4MzkiLCJjbGllbnRJZCI6InZpaWEtZnBwIiwicm9sZSI6IkNsaWVudFVzZXIiLCJzZXNzaW9uSWQiOiJhZGIy097298234gtYWM4Yy1kYWM5Zjk0NTk3ZWQiLCJuYmYiOjE1Njc1MDAwOTQsImV4cCI6MTU2NzUwMzY5NCwiaWF0IjoxNTY3NTAwMDk0fQ.39njmCN97823498UbPXUiXl_SmWgnxM2x9phxhAxYI",
    "expires_in": 300,
    "redirect_uri": null,
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI797234J9.eyJ12Vy98762872344OTI3MS1mOTY1LTRmNWMtOTlmOS1lNDViNzNiYzI4MzkiLCJjbGllbnRJZCI6InZpaWEtZnBwIiwiY29uc2VudElkIjoiYTYyODExYWYtNzUxMS00ZWQ0LThiYTEtMjAwNzc2NGQ1MTIwIiwic2Vzc2lvbklkIjoiYWRiMjEyNmEtOTczZi00OWI4LWFjOGMtZGFjOWY5NDU5N2VkIiwicm9sZSI6IlJlZnJlc2hUb2tlbiI98o727934UwMDA5NCwiZXhwIjoxNTY4NzA5Njk0LCJpYXQiOjE1Njc1MDAwOTR9.6eBV4OH96782734HEQoMbB_9yedl_2JfzsiSNcwa0",
    "token_type": "bearer"
}

The new access_token and refresh_token can now be used for requests.

PreviousAuthorization ScopesNextReference

Last updated 1 year ago

Was this helpful?