Skip to content

Commit

Permalink
Merge pull request #33 from xiaoshenlin/main
Browse files Browse the repository at this point in the history
Allow `createKindeBrowserClient` with custom `SessionManager`
  • Loading branch information
coel authored Nov 29, 2023
2 parents 75d395c + 5be1808 commit 51f02d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/sdk/clients/browser/authcode-with-pkce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import type {
CreateOrgURLOptions,
RegisterURLOptions,
LoginURLOptions,
PKCEClientOptions,
BrowserPKCEClientOptions,
} from '../types.js';

const createAuthCodeWithPKCEClient = (options: PKCEClientOptions) => {
const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
const { featureFlags, tokenClaims } = utilities;
const sessionManager = new BrowserSessionManager();
const sessionManager = options.sessionManager ?? new BrowserSessionManager();
const client = new AuthCodeWithPKCE(options);

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/sdk/clients/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import createAuthCodeWithPKCEClient from './authcode-with-pkce.js';
import { isBrowserEnvironment } from '../../environment.js';
import type { PKCEClientOptions } from '../types.js';
import type { BrowserPKCEClientOptions } from '../types.js';

export const createKindeBrowserClient = (options: PKCEClientOptions) => {
export const createKindeBrowserClient = (options: BrowserPKCEClientOptions) => {
if (!isBrowserEnvironment()) {
throw new Error('this method must be invoked in a browser environment');
}
Expand Down
5 changes: 5 additions & 0 deletions lib/sdk/clients/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import type {
AuthorizationCodeOptions,
AuthURLOptions,
} from '../oauth2-flows/index.js';
import { type SessionManager} from "../session-managers";

export interface BrowserPKCEClientOptions extends AuthorizationCodeOptions {
sessionManager?: SessionManager
}

export interface PKCEClientOptions extends AuthorizationCodeOptions {}
export interface CCClientOptions extends ClientCredentialsOptions {}
Expand Down

0 comments on commit 51f02d7

Please sign in to comment.