Skip to content

Commit

Permalink
Merge pull request #50 from kinde-oss/dave/feature/authUrlParams
Browse files Browse the repository at this point in the history
feat: add auth url params object
  • Loading branch information
DaveOrDead authored Oct 26, 2023
2 parents 57eb13a + 275ff41 commit ca3c2f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 39 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/npm-publish.yml

This file was deleted.

8 changes: 5 additions & 3 deletions src/createKindeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ const createKindeClient = async (
start_page,
is_create_org,
org_name = '',
org_code
org_code,
authUrlParams = {}
} = options;

const {state, code_challenge, url} = await setupChallenge(
config.authorization_endpoint,
app_state
Expand Down Expand Up @@ -307,7 +307,9 @@ const createKindeClient = async (
searchParams.org_name = org_name;
}

url.search = String(new URLSearchParams(searchParams));
url.search = String(
new URLSearchParams(Object.assign(authUrlParams, searchParams))
);
window.location.href = url.toString();
};

Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type KindeClientOptions = {
client_id?: string;
redirect_uri: string;
domain: string;
authUrlParams: object;
is_dangerously_use_local_storage?: boolean;
logout_uri?: string;
on_redirect_callback?: (user: KindeUser, appState?: object) => void;
Expand Down Expand Up @@ -90,6 +91,7 @@ export type RedirectOptions = OrgOptions &
AuthOptions & {
start_page?: string;
is_create_org?: boolean;
authUrlParams?: object;
};

export type KindeClient = {
Expand Down

0 comments on commit ca3c2f0

Please sign in to comment.