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 @@ +/** + *
( + 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