Skip to content

Commit

Permalink
Support custom params for token request
Browse files Browse the repository at this point in the history
  • Loading branch information
kaviththiranga committed Jul 25, 2024
1 parent bf4ada3 commit 87a18d9
Show file tree
Hide file tree
Showing 4 changed files with 7,309 additions and 7,232 deletions.
7 changes: 5 additions & 2 deletions lib/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ class AuthAPI {
authorizationCode: string,
sessionState: string,
authState?: string,
callback?: (response: BasicUserInfo) => void
callback?: (response: BasicUserInfo) => void,
tokenRequestConfig?: {
params: Record<string, unknown>
}
): Promise<BasicUserInfo> {
return this._client
.signIn(config, authorizationCode, sessionState, authState)
.signIn(config, authorizationCode, sessionState, authState, tokenRequestConfig)
.then(async (response: BasicUserInfo) => {
if (!response) {
return;
Expand Down
8 changes: 6 additions & 2 deletions lib/src/authenticate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
authorizationCode?: string,
sessionState?: string,
authState?: string,
callback?: (response: BasicUserInfo) => void
callback?: (response: BasicUserInfo) => void,
tokenRequestConfig?: {
params: Record<string, unknown>
}
): Promise<BasicUserInfo> => {
try {
setError(null);
Expand All @@ -96,7 +99,8 @@ const AuthProvider: FunctionComponent<PropsWithChildren<AuthProviderPropsInterfa
authorizationCode,
sessionState,
authState,
callback
callback,
tokenRequestConfig
);
} catch (error) {
return Promise.reject(error);
Expand Down
5 changes: 4 additions & 1 deletion lib/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ export interface AuthContextInterface {
authorizationCode?: string,
sessionState?: string,
state?: string,
callback?: (response: BasicUserInfo) => void
callback?: (response: BasicUserInfo) => void,
tokenRequestConfig?: {
params: Record<string, unknown>
}
) => Promise<BasicUserInfo>;
signOut: (callback?: (response: boolean) => void) => Promise<boolean>;
getBasicUserInfo(): Promise<BasicUserInfo>;
Expand Down
Loading

0 comments on commit 87a18d9

Please sign in to comment.