Skip to content
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

fix: codeExchange, storage updates, generateAuthUrl fixes #15

Merged
merged 30 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e0e2422
fix: couple of small updates to generateAuthUrl, including auto setti…
DanielRivers Oct 24, 2024
3c00453
fix: remove exception when no state
DanielRivers Oct 25, 2024
c110df8
tests: fix tests
DanielRivers Oct 25, 2024
d8313d7
test: fix tests
DanielRivers Oct 25, 2024
b4fde7a
Merge branch 'main' into fix/generateAuthUrl
DanielRivers Oct 25, 2024
19ccb41
test: fix tests
DanielRivers Oct 25, 2024
8daa59d
feat: added hasActiveStorage and JSDocs
DanielRivers Oct 25, 2024
78a96b6
BREAKING CHANGE: Make generateAuthUrl async
DanielRivers Oct 25, 2024
3658bc4
fix: PR updates
DanielRivers Oct 25, 2024
05e7203
fix: add missing StorageKey
DanielRivers Oct 25, 2024
6e2399f
feat: add clearActiveStorage and tests
DanielRivers Oct 28, 2024
bd82a91
chore: lint
DanielRivers Oct 28, 2024
f8f605a
chore: clean up tests
DanielRivers Oct 28, 2024
7c649b4
fix: extend code verifier
DanielRivers Oct 28, 2024
8c9474c
feat: add remove multiple items support from store
DanielRivers Oct 28, 2024
eb514ce
feat: add exchangeAuthCode method
DanielRivers Oct 28, 2024
912a7cb
chore: lint and remove only from tests
DanielRivers Oct 28, 2024
b33533e
chore: update lock
DanielRivers Oct 28, 2024
5ba4864
chore: remove incomplete store.
DanielRivers Oct 28, 2024
62ebed6
feat: added framework settings config and expanded tests
DanielRivers Oct 29, 2024
3243c4e
test: update tests
DanielRivers Oct 29, 2024
eff28e6
chore: lint
DanielRivers Oct 29, 2024
7c866c1
chore: update test config
DanielRivers Oct 29, 2024
c78f029
feat: improve splitString
DanielRivers Oct 30, 2024
4f0e74b
fix: await removing storage items
DanielRivers Oct 31, 2024
d033a0d
feat: add handling bad responses from token endpoint
DanielRivers Oct 31, 2024
00a554f
fix: error handling improvements and improved security
DanielRivers Oct 31, 2024
b6877c0
test: minor updates
DanielRivers Oct 31, 2024
e0d39fd
fix: preseve browser state
DanielRivers Oct 31, 2024
034021b
chore: remove redundant import
DanielRivers Oct 31, 2024
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
Prev Previous commit
Next Next commit
test: fix tests
DanielRivers committed Oct 25, 2024
commit 19ccb41fdb6905343bfbb92c59bef8745989a418
6 changes: 2 additions & 4 deletions lib/utils/token/getDecodedToken.test.ts
Original file line number Diff line number Diff line change
@@ -5,10 +5,8 @@ import { setActiveStorage } from ".";
import { createMockAccessToken } from "./testUtils";

describe("getDecodedToken", () => {
it("error when no active storage is set", () => {
expect(() => getDecodedToken("idToken")).rejects.toThrowError(
"Session manager is not initialized",
);
it("return null when no active storage is defined", async () => {
expect(await getDecodedToken("idToken")).toBe(null);
});
});

4 changes: 4 additions & 0 deletions lib/utils/token/getDecodedToken.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,10 @@ export const getDecodedToken = async <
): Promise<T | null> => {
const activeStorage = getActiveStorage();

if (!activeStorage) {
return null;
}

const token = (await activeStorage.getSessionItem(
tokenType === "accessToken" ? StorageKeys.accessToken : StorageKeys.idToken,
)) as string;