refactor(nextauth): change provider from Google to Keycloak
- using self-hosted keycloak as SSO `https://sso.mareshq.com`
This commit is contained in:
parent
083fe4565d
commit
2a7b833b2e
7 changed files with 40 additions and 25 deletions
|
|
@ -5,7 +5,7 @@ import {
|
|||
type NextAuthOptions,
|
||||
type DefaultSession,
|
||||
} from "next-auth";
|
||||
import GoogleProvider from "next-auth/providers/google";
|
||||
import KeycloakProvider from "next-auth/providers/keycloak";
|
||||
import { env } from "~/env.mjs";
|
||||
import { prisma } from "~/server/db";
|
||||
|
||||
|
|
@ -49,9 +49,14 @@ export const authOptions: NextAuthOptions = {
|
|||
},
|
||||
adapter: PrismaAdapter(prisma),
|
||||
providers: [
|
||||
GoogleProvider({
|
||||
clientId: env.GOOGLE_CLIENT_ID,
|
||||
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||
KeycloakProvider({
|
||||
clientId: env.KEYCLOAK_CLIENT_ID,
|
||||
clientSecret: env.KEYCLOAK_CLIENT_SECRET,
|
||||
issuer: env.KEYCLOAK_ISSUER,
|
||||
// authorizationUrl: env.KEYCLOAK_ISSUER + "/protocol/openid-connect/auth",
|
||||
// accessTokenUrl: env.KEYCLOAK_ISSUER + "/protocol/openid-connect/token",
|
||||
// profileUrl: env.KEYCLOAK_ISSUER + "/protocol/openid-connect/userinfo",
|
||||
// wellKnown: env.KEYCLOAK_ISSUER + "/.well-known/openid-configuration",
|
||||
}),
|
||||
/**
|
||||
* ...add more providers here.
|
||||
|
|
|
|||
Reference in a new issue