From e36d4d316ab9b317e5536a000afcda2ebd0a373f Mon Sep 17 00:00:00 2001 From: Vijay Singh Date: Wed, 29 Oct 2025 12:21:25 +0530 Subject: [PATCH] New: Added the ssojet in the oidc providers --- .github/ISSUE_TEMPLATE/2_bug_provider.yml | 1 + .prettierignore | 1 + apps/examples/nextjs/auth.ts | 6 ++ docs/public/img/providers/ssojet.svg | 1 + packages/core/src/providers/ssojet.ts | 93 +++++++++++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 docs/public/img/providers/ssojet.svg create mode 100644 packages/core/src/providers/ssojet.ts diff --git a/.github/ISSUE_TEMPLATE/2_bug_provider.yml b/.github/ISSUE_TEMPLATE/2_bug_provider.yml index 1ee4409a23..fe9a0f06eb 100644 --- a/.github/ISSUE_TEMPLATE/2_bug_provider.yml +++ b/.github/ISSUE_TEMPLATE/2_bug_provider.yml @@ -90,6 +90,7 @@ body: - "SimpleLogin" - "Slack" - "Spotify" + - "SSOJet" - "Strava" - "Threads" - "Tiktok" diff --git a/.prettierignore b/.prettierignore index c6856beab2..ea4ff1cec1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,6 +13,7 @@ pnpm-lock.yaml *.d.ts *.d.ts.map **/*.sh +**/*.svg .svelte-kit .next diff --git a/apps/examples/nextjs/auth.ts b/apps/examples/nextjs/auth.ts index fa7c049ea3..bf7838eb5c 100644 --- a/apps/examples/nextjs/auth.ts +++ b/apps/examples/nextjs/auth.ts @@ -28,6 +28,7 @@ import Reddit from "next-auth/providers/reddit" import Slack from "next-auth/providers/slack" import Salesforce from "next-auth/providers/salesforce" import Spotify from "next-auth/providers/spotify" +import SSOJet from "next-auth/providers/ssojet" import Twitch from "next-auth/providers/twitch" import Twitter from "next-auth/providers/twitter" import Vipps from "next-auth/providers/vipps" @@ -91,6 +92,11 @@ export const { handlers, auth, signIn, signOut } = NextAuth({ Reddit, Salesforce, Slack, + SSOJet({ + clientId: process.env.AUTH_SSOJET_CLIENT_ID!, + clientSecret: process.env.AUTH_SSOJET_CLIENT_SECRET!, + issuer: process.env.AUTH_SSOJET_ISSUER!, + }), Spotify, Twitch, Twitter, diff --git a/docs/public/img/providers/ssojet.svg b/docs/public/img/providers/ssojet.svg new file mode 100644 index 0000000000..609b30d913 --- /dev/null +++ b/docs/public/img/providers/ssojet.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/core/src/providers/ssojet.ts b/packages/core/src/providers/ssojet.ts new file mode 100644 index 0000000000..26b458be12 --- /dev/null +++ b/packages/core/src/providers/ssojet.ts @@ -0,0 +1,93 @@ +/** + *
+ * + * Built-in sign in with SSOJet integration. + * + * + * + * + *
+ * + * @module providers/ssojet + */ +import type { OIDCConfig, OIDCUserConfig } from "./index.js" + +/** The returned user profile from SSOJet when using the profile callback. */ +export interface SSOJetProfile extends Record { + /** The user's unique identifier. */ + sub: string + /** The user's email address. */ + email: string + /** Indicates whether the user has verified their email address. */ + email_verified: boolean + /** The user's full name. */ + name: string + /** The user's given name. */ + given_name: string + /** The user's family name. */ + family_name: string + /** URL pointing to the user's profile picture. */ + picture: string + /** The user's preferred username. */ + preferred_username: string + /** The user's locale. */ + locale: string + /** The user's timezone. */ + zoneinfo: string + /** Timestamp indicating when the user profile was last updated. */ + updated_at: number +} + +/** + * ### Setup + * + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/ssojet + * ``` + * + * #### Configuration + * ```ts + * import { Auth } from "@auth/core" + * import SSOJet from "@auth/core/providers/ssojet" + * + * const request = new Request(origin) + * const response = await Auth(request, { + * providers: [ + * SSOJet({ + * clientId: AUTH_SSOJET_CLIENT_ID, + * clientSecret: AUTH_SSOJET_CLIENT_SECRET, + * issuer: AUTH_SSOJET_ISSUER, + * }), + * ], + * }) + * ``` + * + * ### Resources + * + * - [SSOJet OIDC documentation](https://docs.ssojet.com/en/sso/quickstart/) + * - [SSOJet NextAuth.js integration guide](https://docs.ssojet.com/en/sso/quickstart/fullstack/nextjs/) + * + * ### Notes + * + * The SSOJet provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/ssojet.ts). To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/configuring-oauth-providers). + * + * ## Help + * + * If you think you found a bug in the default configuration, you can [open an issue](https://authjs.dev/new/provider-issue). + * + * Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from + * the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, + * we might not pursue a resolution. You can ask for more help in [Discussions](https://authjs.dev/new/github-discussions). + */ +export default function SSOJet( + config: OIDCUserConfig +): OIDCConfig { + return { + id: "ssojet", + name: "SSOJet", + type: "oidc", + style: { text: "#fff", bg: "#1a1a1a" }, + options: config, + } +}