Skip to content

Commit

Permalink
fix auth providers
Browse files Browse the repository at this point in the history
  • Loading branch information
prostgles committed Nov 24, 2024
1 parent e105c3c commit f36b518
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
10 changes: 4 additions & 6 deletions lib/Auth/AuthTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,16 @@ export type AuthClientRequest = { socket: PRGLIOSocket } | { httpReq: ExpressReq

type ThirdPartyProviders = {
facebook?: Pick<FacebookStrategy, "clientID" | "clientSecret"> & {
// appId: string;
// appSecret: string;
authOpts: AuthenticateOptions;
authOpts?: AuthenticateOptions;
};
google?: Pick<GoogleStrategy, "clientID" | "clientSecret"> & {
authOpts: AuthenticateOptions;
authOpts?: AuthenticateOptions;
};
github?: Pick<GitHubStrategy, "clientID" | "clientSecret"> & {
authOpts: AuthenticateOptions;
authOpts?: AuthenticateOptions;
};
microsoft?: Pick<MicrosoftStrategyOptions, "clientID" | "clientSecret"> & {
authOpts: AuthenticateOptions;
authOpts?: AuthenticateOptions;
};
};

Expand Down
8 changes: 6 additions & 2 deletions lib/Auth/setAuthSignup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const setAuthSignup = ({ registrations, app }: Required<Auth>["expressCon
);

app.get(`/auth/${providerName}`,
passport.authenticate(providerName, authOpts)
passport.authenticate(providerName, authOpts ?? {})
);

app.get(callbackPath,
Expand All @@ -84,7 +84,11 @@ export const setAuthSignup = ({ registrations, app }: Required<Auth>["expressCon

export const getProviders = (registrations: Required<Auth>["expressConfig"]["registrations"]): AuthSocketSchema["providers"] | undefined => {
if(!registrations) return undefined;
const { email, websiteUrl, onRegister, ...providers } = registrations;
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
email, websiteUrl, onRegister,
...providers
} = registrations;
if(isEmpty(providers)) return undefined;

const result: AuthSocketSchema["providers"] = {}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prostgles-server",
"version": "4.2.137",
"version": "4.2.138",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions tests/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "ISC",
"dependencies": {
"@types/node": "^20.9.2",
"prostgles-client": "^4.0.145",
"prostgles-client": "^4.0.146",
"prostgles-types": "^4.0.51",
"socket.io-client": "^4.7.5"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f36b518

Please sign in to comment.