From 4a482e834299bf5e387d649219c6ba89607cd24e Mon Sep 17 00:00:00 2001 From: prostgles Date: Sun, 24 Nov 2024 22:21:28 +0200 Subject: [PATCH] fix auth providers --- lib/Auth/AuthTypes.ts | 2 +- lib/Auth/setAuthSignup.ts | 3 ++- package-lock.json | 4 ++-- package.json | 2 +- tests/server/index.ts | 8 ++++++++ tests/server/package-lock.json | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/Auth/AuthTypes.ts b/lib/Auth/AuthTypes.ts index 70dfb6e5..afc7e31e 100644 --- a/lib/Auth/AuthTypes.ts +++ b/lib/Auth/AuthTypes.ts @@ -115,7 +115,7 @@ export type AuthRegistrationConfig = RegistrationProviders & { /** * Do something with the registered user */ - onRegister: (data: RegistrationData) => Promise; + onRegister: (data: RegistrationData) => void | Promise; }; export type SessionUser = { diff --git a/lib/Auth/setAuthSignup.ts b/lib/Auth/setAuthSignup.ts index c2783ccb..956492de 100644 --- a/lib/Auth/setAuthSignup.ts +++ b/lib/Auth/setAuthSignup.ts @@ -1,5 +1,6 @@ import { Auth } from './AuthTypes'; -import passport from "passport"; +/** For some reason normal import is undefined */ +const passport = require("passport") as typeof import("passport"); import { Strategy as GoogleStrategy } from "passport-google-oauth20"; import { Strategy as GitHubStrategy } from "passport-github2"; import { Strategy as MicrosoftStrategy } from "passport-microsoft"; diff --git a/package-lock.json b/package-lock.json index db067629..1529eccc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prostgles-server", - "version": "4.2.139", + "version": "4.2.140", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "prostgles-server", - "version": "4.2.139", + "version": "4.2.140", "license": "MIT", "dependencies": { "body-parser": "^1.20.3", diff --git a/package.json b/package.json index f14a5f55..384832c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prostgles-server", - "version": "4.2.139", + "version": "4.2.140", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/tests/server/index.ts b/tests/server/index.ts index e94c0fe0..d952ba30 100644 --- a/tests/server/index.ts +++ b/tests/server/index.ts @@ -197,6 +197,14 @@ function dd(){ log(req.originalUrl) res.sendFile(path.join(__dirname, '../../index.html')); }, + registrations: { + websiteUrl: "http://localhost:3000", + github: { + clientID: "GITHUB_CLIENT_ID", + clientSecret: "GITHUB" + }, + onRegister: console.log + }, } }, publishMethods: async (params) => { diff --git a/tests/server/package-lock.json b/tests/server/package-lock.json index da705186..70ef9e87 100644 --- a/tests/server/package-lock.json +++ b/tests/server/package-lock.json @@ -21,7 +21,7 @@ }, "../..": { "name": "prostgles-server", - "version": "4.2.139", + "version": "4.2.140", "license": "MIT", "dependencies": { "body-parser": "^1.20.3",