Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to the ordercloud-javascript-sdk will be documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [11.1.0] - 2025-07-22
- Add identity provider token management

# [11.0.7] - 2025-07-16
- Bring SDK up to date with API v1.0.407

Expand Down
23 changes: 23 additions & 0 deletions codegen/templates/api/Tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ class Tokens {
private impersonationTokenCookieName = '.impersonation-token'
private refreshTokenCookieName = '.refresh-token'
private identityTokenCookieName = '.identity-token'
private identityProviderAccessTokenCookieName = '.idp-access-token'

private accessToken?: string = null
private impersonationToken?: string = null
private refreshToken?: string = null
private identityToken?: string = null
private identityProviderAccessToken?: string = null

/**
* @ignore
Expand Down Expand Up @@ -145,6 +147,27 @@ class Tokens {
: cookies.remove(this.identityTokenCookieName)
}

/**
* Manage Identity Provider Tokens
*/
public GetIdpAccessToken(): string | undefined {
return isServer
? this.identityProviderAccessToken
: cookies.get(this.identityProviderAccessTokenCookieName)
}

public SetIdpAccessToken(token: string): void {
isServer
? (this.identityProviderAccessToken = token)
: cookies.set(this.identityProviderAccessTokenCookieName, token)
}

public RemoveIdpAccessToken(): void {
isServer
? (this.identityProviderAccessToken = null)
: cookies.remove(this.identityProviderAccessTokenCookieName)
}

/**
* If no token is provided will attempt to get and validate token
* stored in sdk. If token is invalid or missing it will also attempt
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

89 changes: 70 additions & 19 deletions docs/classes/Resources.Tokens.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/variables/Tokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h1>Variable Tokens</h1></div>
<div class="tsd-signature">Tokens<span class="tsd-signature-symbol">:</span> <a href="../classes/Resources.Tokens.html" class="tsd-signature-type" data-tsd-kind="Class">Tokens</a></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Tokens.ts#L207">api/Tokens.ts:207</a></li></ul></aside></div>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Tokens.ts#L230">api/Tokens.ts:230</a></li></ul></aside></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ordercloud-javascript-sdk",
"description": "The offical Javascript SDK for the Ordercloud ecommerce API",
"author": "Four51 OrderCloud",
"version": "11.0.7",
"version": "11.1.0",
"main": "dist/index.js",
"umd:main": "dist/index.umd.js",
"module": "dist/index.esm.js",
Expand Down
23 changes: 23 additions & 0 deletions src/api/Tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ class Tokens {
private impersonationTokenCookieName = '.impersonation-token'
private refreshTokenCookieName = '.refresh-token'
private identityTokenCookieName = '.identity-token'
private identityProviderAccessTokenCookieName = '.idp-access-token'

private accessToken?: string = null
private impersonationToken?: string = null
private refreshToken?: string = null
private identityToken?: string = null
private identityProviderAccessToken?: string = null

/**
* @ignore
Expand Down Expand Up @@ -145,6 +147,27 @@ class Tokens {
: cookies.remove(this.identityTokenCookieName)
}

/**
* Manage Identity Provider Tokens
*/
public GetIdpAccessToken(): string | undefined {
return isServer
? this.identityProviderAccessToken
: cookies.get(this.identityProviderAccessTokenCookieName)
}

public SetIdpAccessToken(token: string): void {
isServer
? (this.identityProviderAccessToken = token)
: cookies.set(this.identityProviderAccessTokenCookieName, token)
}

public RemoveIdpAccessToken(): void {
isServer
? (this.identityProviderAccessToken = null)
: cookies.remove(this.identityProviderAccessTokenCookieName)
}

/**
* If no token is provided will attempt to get and validate token
* stored in sdk. If token is invalid or missing it will also attempt
Expand Down