-
Notifications
You must be signed in to change notification settings - Fork 40
[MOB-10946] Update JWT in ts #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lposen
merged 20 commits into
jwt/master
from
jwt/MOB-10946-task-2-authfailure-and-retrypolicy-ts-classes
Oct 14, 2025
Merged
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
bd32975
feat: add authentication failure and retry policy enums and types
lposen 50ef0e6
chore: update eslint-config-prettier and add prettier-eslint dependency
lposen af0065e
feat: export new authentication and retry policy types in index files
lposen 762f333
feat: enhance IterableConfig with JWT error handling and retry policy…
lposen cfe1de2
feat: add onAuthFailure and pauseAuthRetries methods to Iterable class
lposen 7fde4e7
feat: implement retry policy and JWT error handling in IterableAppPro…
lposen 5810a0a
feat: improve JWT error handling and enhance IterableConfig with addi…
lposen e85d660
refactor: remove onAuthFailure method and update event handler setup …
lposen c32447f
chore: remove unused index.ts file from hooks directory
lposen 6d8c45a
refactor: simplify authHandler type and standardize IterableAuthFailu…
lposen a63b9dc
refactor: remove onJWTErrorPresent flag from IterableConfig to stream…
lposen 786a079
Merge branch 'jwt/master' into jwt/MOB-10946-task-2-authfailure-and-r…
lposen f1d10cb
chore: update yarn.lock
lposen 65cb551
feat: add authentication manager to Iterable class
lposen 5bbb5fc
refactor: remove pauseAuthRetries method from Iterable class
lposen 92fbff1
chore: disable TSDoc syntax rule for IterableRetryBackoff enum
lposen e94100f
feat: add pauseAuthRetries method to authentication manager and enhan…
lposen 841f63f
Merge branch 'jwt/master' into jwt/MOB-10946-task-2-authfailure-and-r…
lposen 1dbd4e2
Merge branch 'jwt/master' into jwt/MOB-10946-task-2-authfailure-and-r…
lposen 71ac5c4
docs: add better comments to IterableAuthManager
lposen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /** | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * The reason for the failure of an authentication attempt. | ||
| * | ||
| * This is generally related to JWT token validation. | ||
| */ | ||
| export enum IterableAuthFailureReason { | ||
| /** | ||
| * An auth token's expiration must be less than one year from its issued-at | ||
| * time. | ||
| */ | ||
| AUTH_TOKEN_EXPIRATION_INVALID, | ||
| /** The token has expired. */ | ||
| AUTH_TOKEN_EXPIRED, | ||
| /** Token has an invalid format (failed a regular expression check). */ | ||
| AUTH_TOKEN_FORMAT_INVALID, | ||
| /** `onAuthTokenRequested` threw an exception. */ | ||
| AUTH_TOKEN_GENERATION_ERROR, | ||
| /** Any other error not captured by another constant. */ | ||
| AUTH_TOKEN_GENERIC_ERROR, | ||
| /** Iterable has invalidated this token and it cannot be used. */ | ||
| AUTH_TOKEN_INVALIDATED, | ||
| /** The request to Iterable's API did not include a JWT authorization header. */ | ||
| AUTH_TOKEN_MISSING, | ||
| /** `onAuthTokenRequested` returned a null JWT token. */ | ||
| AUTH_TOKEN_NULL, | ||
| /** | ||
| * Iterable could not decode the token's payload (`iat`, `exp`, `email`, | ||
| * or `userId`). | ||
| */ | ||
| AUTH_TOKEN_PAYLOAD_INVALID, | ||
| /** Iterable could not validate the token's authenticity. */ | ||
| AUTH_TOKEN_SIGNATURE_INVALID, | ||
| /** | ||
| * The token doesn't include an `email` or a `userId`. Or, one of these | ||
| * values is included, but it references a user that isn't in the Iterable | ||
| * project. | ||
| */ | ||
| AUTH_TOKEN_USER_KEY_INVALID, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /** | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * The type of backoff to use when retrying a request. | ||
| */ | ||
| export enum IterableRetryBackoff { | ||
| /** | ||
| * Linear backoff (each retry will wait for a fixed interval) | ||
| * TODO: check with @Ayyanchira if this is correct | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| LINEAR = 'LINEAR', | ||
| /** | ||
| * Exponential backoff (each retry will wait for an interval that increases exponentially) | ||
| * TODO: check with @Ayyanchira if this is correct | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| EXPONENTIAL = 'EXPONENTIAL', | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| export * from './IterableActionSource'; | ||
| export * from './IterableAuthFailureReason'; | ||
| export * from './IterableAuthResponseResult'; | ||
| export * from './IterableDataRegion'; | ||
| export * from './IterableEventName'; | ||
| export * from './IterableLogLevel'; | ||
| export * from './IterablePushPlatform'; | ||
| export * from './IterableRetryBackoff'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import type { IterableAuthFailureReason } from "../enums/IterableAuthFailureReason"; | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * The details of an auth failure. | ||
| */ | ||
| export interface IterableAuthFailure { | ||
| /** `userId` or `email` of the signed-in user */ | ||
| userKey: string; | ||
|
|
||
| /** The `authToken` which caused the failure */ | ||
| failedAuthToken: string; | ||
|
|
||
| /** The timestamp of the failed request */ | ||
| failedRequestTime: number; | ||
|
|
||
| /** Indicates a reason for failure */ | ||
| failureReason: IterableAuthFailureReason; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import type { IterableRetryBackoff } from "../enums/IterableRetryBackoff"; | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * The policy for retrying an authentication attempt. | ||
| */ | ||
| export interface IterableRetryPolicy { | ||
| /** Number of consecutive JWT refresh retries the SDK should attempt */ | ||
| maxRetry: number; | ||
| /** | ||
| * Duration between JWT refresh retries in seconds | ||
| * (starting point for retry backoff) | ||
| */ | ||
| retryInterval: number; | ||
| /** The backoff pattern to apply between retry attempts. */ | ||
| retryBackoff: IterableRetryBackoff; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export * from './IterableAuthFailure'; | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| export * from './IterableEdgeInsetDetails'; | ||
| export * from './IterableRetryPolicy'; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,17 +14,24 @@ export { | |
| } from './core/classes'; | ||
| export { | ||
| IterableActionSource, | ||
| IterableAuthFailureReason, | ||
| IterableAuthResponseResult, | ||
| IterableDataRegion, | ||
| IterableEventName, | ||
| IterableLogLevel, | ||
| IterablePushPlatform, | ||
| IterableRetryBackoff, | ||
| } from './core/enums'; | ||
| export { | ||
| useAppStateListener, | ||
| useDeviceOrientation, | ||
| type IterableDeviceOrientation, | ||
| } from './core/hooks'; | ||
| export { type IterableEdgeInsetDetails } from './core/types'; | ||
| export type { | ||
| IterableAuthFailure, | ||
| IterableEdgeInsetDetails, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if EdgeInsetDetails falls under JWT changes. But is it for the inapp display issue? |
||
| IterableRetryPolicy, | ||
| } from './core/types'; | ||
| export { | ||
| IterableHtmlInAppContent, | ||
| IterableInAppCloseSource, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.