Skip to content

loadUserProfile() no longer typesafe #1144

Open
@freis-hdi

Description

@freis-hdi

I just upgraded to version 12 and face an issue with loading the userinfo.

After PR #939 the return type of loadUserProfile() changed from Userinfo to Userinfo | string and now to object.

I thought, I could still at least cast to Userinfo, but weirdly the response is wrapped like this:

{
  "info": {
    "sub": "...",
    "name": "...",
    ...
  }
}

instead of

{
  "sub": "...",
  "name": "...",
  ...
}

so that I would have to call

private userinfoSubject$ = new ReplaySubject<UserInfo>();

...

  this.oauthService.loadUserProfile().then(userinfo => {
    // tslint:disable-next-line
    this.userinfoSubject$.next(userinfo['info'] as UserInfo);
    ...
  }

I would really like to find a cleaner solution to this.

Is the response wrapped in "info" on purpose?
And why did the response type change from Userinfo | string to object?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsIssues that involve improving or adding documentation.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions