GithubHelp home page GithubHelp logo

Comments (4)

derisen avatar derisen commented on June 18, 2024

This looks more to do with TypeScript than with MSAL. And I would say there's nothing wrong here. In case auth.getAccount() fails for some reason, your account variable will be set to null, so oid will be null too. So you are asserting that it will not be null with the (!) mark. (but yeah oid will be always be a string as long as getAccount() succeeds)

You could of course ask why should getAccount() return null when fails and not something else on msal.js repo.

from ms-identity-javascript-v2.

DarkLite1 avatar DarkLite1 commented on June 18, 2024

I've looked a bit further into this. When you look at Account.ts you see the following lines:

import { StringDict } from "./MsalTypes";
idTokenClaims: StringDict;

When verifying MsalTypes we see this:

export type StringDict = {[key: string]: string};

The issue with this setup is that the property oid on the object idTokenClaims can be undefined when it's not added. I think this is why TS fails to see that there is always an oid property when getAccount() succeeds.

If I got this wrong please correct me. As I see it now there are 3 options:

  • Either TS should be smart enough to see that the property oid is always there when getAccount() succeeds, this is not the case, so there should be a bug report at TS for this issue.
  • TS is correct but the type definition in the msal library is incorrect and should be corrected. So that the property oid is hard coded on the idTokenClaims property.
  • I got it totally wrong, which happens :D

from ms-identity-javascript-v2.

derisen avatar derisen commented on June 18, 2024

Hmm, I would think that the option 2 is more likely. Could you raise this issue in msal.js repo? Not quite sure what was the expectation from server with idTokenClaims.

from ms-identity-javascript-v2.

DarkLite1 avatar DarkLite1 commented on June 18, 2024

Closing this one for the new issue created.

from ms-identity-javascript-v2.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.