Skip to content

Commit

Permalink
Merge pull request #31 from chaitanyakole/redirect_issue
Browse files Browse the repository at this point in the history
Checking with different url
  • Loading branch information
Ishan-ttpl authored Jan 30, 2025
2 parents eb34d5b + 6138231 commit 3d9b968
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function App({ Component, pageProps }: AppProps) {

if (!keycloak || keycloak.authenticated) return;

const redirectUri = `${window.location.origin}/tenant`;
const redirectUri = `${window.location.protocol}//${window.location.hostname}/tenant`;
console.log({ redirectUri });

const authenticated = await keycloak.init({
onLoad: "login-required",
Expand All @@ -62,11 +63,15 @@ function App({ Component, pageProps }: AppProps) {
setIsAuthenticated(true);

if (keycloak.token) {
console.log("Get keycloak token");

localStorage.setItem("token", keycloak.token);
await registerUser();
}
if (keycloak.refreshToken)
if (keycloak.refreshToken) {
console.log("Get keycloak token");
localStorage.setItem("refreshToken", keycloak.refreshToken);
}
} catch (error) {
console.error("Failed to initialize Keycloak:", error);
}
Expand Down

0 comments on commit 3d9b968

Please sign in to comment.