From 42243523d4b6793672470d58cbaeadd2f6b1db8a Mon Sep 17 00:00:00 2001 From: GerardvdStelt Date: Wed, 12 Nov 2025 11:50:08 +0100 Subject: [PATCH] Initial commit --- packages/core/src/providers/propelauth.ts | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packages/core/src/providers/propelauth.ts diff --git a/packages/core/src/providers/propelauth.ts b/packages/core/src/providers/propelauth.ts new file mode 100644 index 0000000000..266aa5a283 --- /dev/null +++ b/packages/core/src/providers/propelauth.ts @@ -0,0 +1,49 @@ +/** + *
+ * Built-in PropelAuth integration. + * + * + * + *
+ * + * @module providers/propelauth + */ +import type { OAuthConfig, OAuthUserConfig } from "./index.js"; + +export interface PropelAuthProfile { + email: string; + user_id: string; + picture_url: string; + last_active_at: string; + org_id_to_org_info: Record; +} + +export default function PropelAuth

( + options: OAuthUserConfig

+): OAuthConfig

{ + const base = options.issuer ?? "https://auth.propelauth.com"; + const oauth = `${base}/propelauth/oauth`; + + return { + id: "propelauth", + name: "PropelAuth", + type: "oauth", + authorization: `${oauth}/authorize`, + token: `${oauth}/token`, + userinfo: `${oauth}/userinfo`, + issuer: base, + profile(profile) { + return { + id: profile.user_id, + email: profile.email, + image: profile.picture_url, + name: profile.email, + orgs: Object.values(profile.org_id_to_org_info).map((org) => ({ + name: org.org_name, + role: org.user_role, + })), + }; + }, + options, + }; +} \ No newline at end of file