After experimenting with this on a number of different projects that had multiple HttpClients and Auth requirements it became apparent that we MUST register the graph client AFTER the Msal config in program.cs
I modified AddGraphClient to accept the configuration so it could resolve it's own settings. This way we only have magic strings in the one code file, seeing that AuthenticateRequestAsync resolves config anyway, this just made sense.
Does this introduce a breaking change?
[x] Yes
[ ] No
The MS Graph in v5 splits the model definitions into their own namespace, the references have been refactored accordingly and this now has a minimum dependency of v5 for MS Graph.
Pull Request Type
What kind of change does this Pull Request introduce?
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[x] Documentation content changes
[ ] Other... Please describe:
How to Test
Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
Test the code
What to Check
Verify that the following are valid
AppSettings.json will need to be updated to use your tenant authority and ClientId
Purpose
AddGraphClient
to accept the configuration so it could resolve it's own settings. This way we only have magic strings in the one code file, seeing thatAuthenticateRequestAsync
resolves config anyway, this just made sense.Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
What to Check
Verify that the following are valid
Other Information