Skip to content

When I use popup mode, I can't get the user #2033

@HoboCY

Description

@HoboCY

Version:
oidc-client-ts: "3.2.1"

I used the SignInPopop mode of UserManager in vue3. After the callback, the token has been obtained. I also checked localstorage and the information has been stored, but I can't get the callback user. I can't get it manually by calling userManager.getUser.

function getUserManager() {
    if (!userManager.value) {
      const oidcSettings: UserManagerSettings = {
        authority: 'https://localhost:44372', 
        client_id: 'WmsApi_App',
        scope: 'openid profile email phone roles',
        redirect_uri: `${window.location.origin}/auth/callback`,
        post_logout_redirect_uri: `${window.location.origin}/auth/login`,
        popup_redirect_uri: `${window.location.origin}/auth/callback`,
        popup_post_logout_redirect_uri: `${window.location.origin}/auth/login`,
        response_type: 'code',
        userStore: new WebStorageStateStore({store: window
          .localStorage
        }),
        response_mode: 'fragment',
      };

      userManager.value = new UserManager(oidcSettings);

    }

    return userManager.value!;
  }
const manager = getUserManager();
await manager.signinPopup();
const userManager = authStore.getUserManager();
const user = await userManager.signinCallback();

The above is my code, the user here is always not available.
Even if I use const user = await userManager.getUser();
I still can't get it, but I checked the internal information of the browser and there is no problem.
I switched to redirect and everything is normal. What is the reason?

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions