init repo
This commit is contained in:
24
src/app/api/auth/[...nextauth]/options.ts
Normal file
24
src/app/api/auth/[...nextauth]/options.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import KeycloakProvider from "next-auth/providers/keycloak";
|
||||
|
||||
const authOptions = {
|
||||
// Configure one or more authentication providers
|
||||
providers: [
|
||||
// !!! Should be stored in .env file.
|
||||
KeycloakProvider({
|
||||
clientId: `refine-demo`,
|
||||
clientSecret: `refine`,
|
||||
issuer: `https://lemur-0.cloud-iam.com/auth/realms/refine`,
|
||||
profile(profile) {
|
||||
return {
|
||||
id: profile.sub,
|
||||
name: profile.name ?? profile.preferred_username,
|
||||
email: profile.email,
|
||||
image: `https://faces-img.xcdn.link/thumb-lorem-face-6312_thumb.jpg`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
secret: `UItTuD1HcGXIj8ZfHUswhYdNd40Lc325R8VlxQPUoR0=`,
|
||||
};
|
||||
|
||||
export default authOptions;
|
||||
5
src/app/api/auth/[...nextauth]/route.ts
Normal file
5
src/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import NextAuth from "next-auth/next";
|
||||
import authOptions from "./options";
|
||||
|
||||
const auth = NextAuth(authOptions);
|
||||
export { auth as GET, auth as POST };
|
||||
Reference in New Issue
Block a user