Comments (4)
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.
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 whengetAccount()
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 theidTokenClaims
property. - I got it totally wrong, which happens :D
from ms-identity-javascript-v2.
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.
Closing this one for the new issue created.
from ms-identity-javascript-v2.
Related Issues (18)
- Protecting my own Web API? HOT 2
- 401 even with a valid token HOT 5
- OauthAllowImplicitFlow set to True. MSAL 2.x apps do not support Implicit flow. HOT 5
- Issue with AADSTS7000218 - 'client_assertion' or 'client_secret'. HOT 1
- Not working due to bug in msal-browser.js 2.3.1 HOT 1
- Path to index.html is wrong and updating it results in javascript errors. HOT 2
- IE11 ES6 Syntax Error for => HOT 4
- showWelcomeMessage wrong argument ?? HOT 1
- Got error in console for cors HOT 2
- Access to fetch from origin has been blocked by CORS HOT 19
- Configuration script registers a web app; needs to register a SPA HOT 2
- "type:cors, status: 200 ok" response from graph endpoint HOT 2
- on login -> not getting code back in the response on signIn (getting accessToken back instead) HOT 1
- Is the AccessToken supposed to be Version 1? HOT 2
- No authentication after redirect HOT 1
- The reference document link in README.md is Implicit grant flow. HOT 2
- Cannot seem to get the configuration to work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ms-identity-javascript-v2.