Skip to content

Commit d05eff1

Browse files
authored
Merge pull request #141 from crhistianramirez/idp-tokens-mgmt
✨ adds identity provider token management
2 parents a31387e + 2698fdb commit d05eff1

File tree

7 files changed

+122
-22
lines changed

7 files changed

+122
-22
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to the ordercloud-javascript-sdk will be documented in this
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
# [11.1.0] - 2025-07-22
9+
- Add identity provider token management
10+
811
# [11.0.7] - 2025-07-16
912
- Bring SDK up to date with API v1.0.407
1013

codegen/templates/api/Tokens.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ class Tokens {
3030
private impersonationTokenCookieName = '.impersonation-token'
3131
private refreshTokenCookieName = '.refresh-token'
3232
private identityTokenCookieName = '.identity-token'
33+
private identityProviderAccessTokenCookieName = '.idp-access-token'
3334

3435
private accessToken?: string = null
3536
private impersonationToken?: string = null
3637
private refreshToken?: string = null
3738
private identityToken?: string = null
39+
private identityProviderAccessToken?: string = null
3840

3941
/**
4042
* @ignore
@@ -145,6 +147,27 @@ class Tokens {
145147
: cookies.remove(this.identityTokenCookieName)
146148
}
147149

150+
/**
151+
* Manage Identity Provider Tokens
152+
*/
153+
public GetIdpAccessToken(): string | undefined {
154+
return isServer
155+
? this.identityProviderAccessToken
156+
: cookies.get(this.identityProviderAccessTokenCookieName)
157+
}
158+
159+
public SetIdpAccessToken(token: string): void {
160+
isServer
161+
? (this.identityProviderAccessToken = token)
162+
: cookies.set(this.identityProviderAccessTokenCookieName, token)
163+
}
164+
165+
public RemoveIdpAccessToken(): void {
166+
isServer
167+
? (this.identityProviderAccessToken = null)
168+
: cookies.remove(this.identityProviderAccessTokenCookieName)
169+
}
170+
148171
/**
149172
* If no token is provided will attempt to get and validate token
150173
* stored in sdk. If token is invalid or missing it will also attempt

docs/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/classes/Resources.Tokens.html

Lines changed: 70 additions & 19 deletions
Large diffs are not rendered by default.

docs/variables/Tokens.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<h1>Variable Tokens</h1></div>
1818
<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">
1919
<ul>
20-
<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>
20+
<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>
2121
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
2222
<div class="tsd-navigation settings">
2323
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ordercloud-javascript-sdk",
33
"description": "The offical Javascript SDK for the Ordercloud ecommerce API",
44
"author": "Four51 OrderCloud",
5-
"version": "11.0.7",
5+
"version": "11.1.0",
66
"main": "dist/index.js",
77
"umd:main": "dist/index.umd.js",
88
"module": "dist/index.esm.js",

src/api/Tokens.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ class Tokens {
3030
private impersonationTokenCookieName = '.impersonation-token'
3131
private refreshTokenCookieName = '.refresh-token'
3232
private identityTokenCookieName = '.identity-token'
33+
private identityProviderAccessTokenCookieName = '.idp-access-token'
3334

3435
private accessToken?: string = null
3536
private impersonationToken?: string = null
3637
private refreshToken?: string = null
3738
private identityToken?: string = null
39+
private identityProviderAccessToken?: string = null
3840

3941
/**
4042
* @ignore
@@ -145,6 +147,27 @@ class Tokens {
145147
: cookies.remove(this.identityTokenCookieName)
146148
}
147149

150+
/**
151+
* Manage Identity Provider Tokens
152+
*/
153+
public GetIdpAccessToken(): string | undefined {
154+
return isServer
155+
? this.identityProviderAccessToken
156+
: cookies.get(this.identityProviderAccessTokenCookieName)
157+
}
158+
159+
public SetIdpAccessToken(token: string): void {
160+
isServer
161+
? (this.identityProviderAccessToken = token)
162+
: cookies.set(this.identityProviderAccessTokenCookieName, token)
163+
}
164+
165+
public RemoveIdpAccessToken(): void {
166+
isServer
167+
? (this.identityProviderAccessToken = null)
168+
: cookies.remove(this.identityProviderAccessTokenCookieName)
169+
}
170+
148171
/**
149172
* If no token is provided will attempt to get and validate token
150173
* stored in sdk. If token is invalid or missing it will also attempt

0 commit comments

Comments
 (0)