oidc-client-js icon indicating copy to clipboard operation
oidc-client-js copied to clipboard

getUser always runs null

Open hungdluit opened this issue 10 years ago • 2 comments

I'm using typescript version with 'asycn/await'.

public getLoggedUser(): Promise<Oidc.User> {
        return this.userManager.getUser();        
 }

  private async onComponentDidMount() {
        let user = await this.userService.getLoggedUser();
        this.onUserChanged(user);
    }

private onUserChanged = (user: Oidc.User): void => {
        if (user === null) {
            this.setState({ rightElement: this.getLoginBnt() });
        } else {
            this.setState({ rightElement: this.getUserControls() });
        }
    }

and the config:

        const config = {
            client_id: 'js',
            redirect_uri: `${window.location.protocol}//${window.location.hostname}:${window.location.port}`,
            response_type: 'id_token token',
            scope: 'openid profile',
            authority: 'http://localhost:5000',
            post_logout_redirect_uri: `${window.location.protocol}//${window.location.hostname}:${window.location.port}/login`,
            silent_redirect_uri: od`${window.location.protocol}//${window.location.hostname}:${window.location.port}/silent_renew.html`,
            automaticSilentRenew: true,
            filterProtocolClaims: true,
            loadUserInfo: true
        };

seeing many related issue, but can find the good fix. Thanks,

hungdluit avatar Nov 19 '16 14:11 hungdluit

This is not enough info for me to help. You will have to debug.

brockallen avatar Nov 21 '16 13:11 brockallen

I closed this issue. This is my missing understanding work-flow.

Thank you

On Thu, Dec 1, 2016 at 10:08 AM, Brock Allen [email protected] wrote:

Closed #203 https://github.com/IdentityModel/oidc-client-js/issues/203.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IdentityModel/oidc-client-js/issues/203#event-877884289, or mute the thread https://github.com/notifications/unsubscribe-auth/AFXNMVVWcRyfT9xPew0Xij88niJbApV7ks5rDjoigaJpZM4K3RIa .

hungdluit avatar Dec 01 '16 03:12 hungdluit