1

I have small vue app that authenticate users with Keycloak backend. I use oidc-client to redirect clients to authentication page.

Whenever the login logic triggers, the URL uses client's url and not the authority. (all query params are correct).

this is the URL on browser:

enter image description here

this is my code (simplified and without URL):

import Oidc from "oidc-client";

let config = {
    authority: "http://XXX.XXX.XXX.XXX:9855/auth/realms/AvosetGo_Tests",
    client_id: "CLIENT-ID",
    redirect_uri: "localhost:4200/callback",
    response_type: "code",
    scope: "openid profile email",
    post_logout_redirect_uri: "http://localhost:4200/",
    automaticSilentRenew: true,
    filterProtocolClaims: true,
    loadUserInfo: true
};
const mgr = new Oidc.UserManager(config);

export const authManager = {
    signin: async () => {
        const user = await mgr.getUser();
        console.log("this is is " + user);
        if (!user) {
            await mgr.signinRedirect();
        }
    }
}

Saturn Technologies
  • 2,653
  • 2
  • 24
  • 41

0 Answers0