Skip to content

Commit

Permalink
feat: add client_secret
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancole authored and simenandre committed Aug 20, 2020
1 parent a2fdf39 commit 151a494
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
AuthContextProps,
} from './AuthContextInterface';

export const AuthContext = React.createContext<AuthContextProps|null>(null);
export const AuthContext = React.createContext<AuthContextProps | null>(null);

/**
* @private
Expand Down Expand Up @@ -34,10 +34,18 @@ export const hasCodeInUrl = (location: Location): boolean => {
*/
export const initUserManager = (props: AuthProviderProps): UserManager => {
if (props.userManager) return props.userManager;
const { authority, clientId, redirectUri, responseType, scope } = props;
const {
authority,
clientId,
clientSecret,
redirectUri,
responseType,
scope,
} = props;
return new UserManager({
authority,
client_id: clientId,
client_secret: clientSecret,
redirect_uri: redirectUri,
silent_redirect_uri: redirectUri,
post_logout_redirect_uri: redirectUri,
Expand Down
4 changes: 4 additions & 0 deletions src/AuthContextInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export interface AuthProviderProps {
* Your client application's identifier as registered with the OIDC/OAuth2 provider.
*/
clientId?: string;
/**
* Client secret defined on the identity server
*/
clientSecret?: string;
/**
* The redirect URI of your client application to receive a response from the OIDC/OAuth2 provider.
*/
Expand Down

0 comments on commit 151a494

Please sign in to comment.