Add required scope for token refresh when refreshing Microsoft OAuth2 token #637
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
Add the missing and required
scope
field when refreshing Microsoft OAuth2 token.Type of change
1 - 🐞 bug 🐞
Additional information
I have been writing an MSGraphAPI extension to fetch/send emails. During development, I changed the scope field many times! Everything worked fine until the automatic token refresh started. Suddenly I lost access to fetch and send emails. Then I dumped the received token in the logs and used https://jwt.ms/, only to see that I lost all my entered MSGraph scopes and the scope contained Outlook stuff again - I removed those completely before, since MSGraphAPI doesn't use any of them.
I went to the
index.pl?Action=AdminOAuth2TokenManagement
page and clicked manually refresh. Everything was working fine again! Until the auto refreshed is made...I have noticed that when the token gets auto-refreshed, the
scope
is not sent within the request. Microsoft then seems to use the first initiated scope with the client token. This seems to be a bug on Microsoft's part! But to be fair, they have written in their Authentication Guides that thescope
field is required.There are also a lot more required fields:
tanant
, which is currently not configurable in Znuny. But hey, it works somehow 😋Checklist