mirror of
https://github.com/PeterMaquiran/tvone.git
synced 2026-04-22 20:15:51 +00:00
simplefy keycloak
This commit is contained in:
@@ -6,30 +6,16 @@ import {
|
||||
Settings, HelpCircle, Image as ImageIcon,
|
||||
Type, Calendar, Clock, Tag, User, Save, Eye, Send
|
||||
} from 'lucide-react';
|
||||
import Keycloak from "keycloak-js";
|
||||
|
||||
// Importe o componente que criámos (ajuste o caminho se necessário)
|
||||
import MultiAspectEditor from '../../components/MultiAspectEditor';
|
||||
import dynamic from "next/dynamic";
|
||||
import { keycloak } from '@/app/feature/auth/keycloak-config';
|
||||
const Editor = dynamic(
|
||||
() => import("@tinymce/tinymce-react").then((mod) => mod.Editor),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
const keycloak = new Keycloak({
|
||||
url: "https://keycloak.petermaquiran.xyz",
|
||||
realm: "tvone", // ✅ IMPORTANT
|
||||
clientId: "tvone-web", // must match Keycloak client
|
||||
});
|
||||
|
||||
interface GoogleAuthResponse {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
scope: string;
|
||||
authuser?: string;
|
||||
prompt?: string;
|
||||
}
|
||||
|
||||
interface KeycloakTokenResponse {
|
||||
access_token: string;
|
||||
@@ -131,8 +117,16 @@ const CreateNewsPage = () => {
|
||||
|
||||
const profile = await res.json();
|
||||
|
||||
setUser(profile);
|
||||
console.log("Profile:", profile);
|
||||
var keycloakData : {
|
||||
email: string,
|
||||
email_verified: boolean,
|
||||
name: string,
|
||||
picture: string,
|
||||
roles: string[]
|
||||
} = profile.keycloak
|
||||
|
||||
setUser(keycloakData);
|
||||
console.log("Profile:", keycloakData);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
@@ -4,14 +4,7 @@ import React, { useState, useEffect } from "react";
|
||||
import { useGoogleLogin } from "@react-oauth/google";
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Sun, Moon } from 'lucide-react'; // Optional: install lucide-react for clean icons
|
||||
import Keycloak from "keycloak-js";
|
||||
|
||||
|
||||
const keycloak = new Keycloak({
|
||||
url: "https://keycloak.petermaquiran.xyz",
|
||||
realm: "tvone", // ✅ IMPORTANT
|
||||
clientId: "tvone-web", // must match Keycloak client
|
||||
});
|
||||
import { keycloak } from '@/app/feature/auth/keycloak-config';
|
||||
|
||||
interface GoogleAuthResponse {
|
||||
access_token: string;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import Keycloak from "keycloak-js";
|
||||
|
||||
/**
|
||||
* KEYCLOAK CONFIGURATION
|
||||
* Logic: Environment variable validation and OIDC configuration.
|
||||
@@ -13,9 +15,15 @@ export const keycloakConfig = {
|
||||
|
||||
// Endpoint for global logout
|
||||
endSessionEndpoint: `${process.env.KEYCLOAK_ISSUER_URL}/realms/${process.env.KEYCLOAK_REALM}/protocol/openid-connect/logout`,
|
||||
};
|
||||
};
|
||||
|
||||
// Simple check to ensure environment variables are present
|
||||
if (!process.env.KEYCLOAK_CLIENT_ID || !process.env.KEYCLOAK_ISSUER_URL) {
|
||||
// Simple check to ensure environment variables are present
|
||||
if (!process.env.KEYCLOAK_CLIENT_ID || !process.env.KEYCLOAK_ISSUER_URL) {
|
||||
console.warn("Auth Warning: Keycloak environment variables are missing.");
|
||||
}
|
||||
}
|
||||
|
||||
export const keycloak = new Keycloak({
|
||||
url: "https://keycloak.petermaquiran.xyz",
|
||||
realm: "tvone", // ✅ IMPORTANT
|
||||
clientId: "tvone-web", // must match Keycloak client
|
||||
});
|
||||
Reference in New Issue
Block a user