auth-node: refactor OAuth scope management #24743
Open
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.
Hey, I just made a Pull Request!
This standardizes scope management across OAuth providers, and also aims to fix a couple of issues, especially providers that persist scopes. The overall goal of this is to be able to completely remove the need for bespoke auth APIs in the frontend, in particular for sign-in.
One issue that's been fixed is refreshing with scope persistence. In the current implementation the persisted scopes will always be used, which can break this client flow where a session is refreshed with requested scopes.
An issue that I'll be aiming to fix in followup usages of this is that many auth providers pass the
scope
option to the passport strategy. That only works if no scopes are requested by the client, because they are not merged. This aims to fix that by properly merging together required, additional, requested and granted scopes.Will do updates for each provider in followups, so that we can get some eyes/testing of each individual update.
✔️ Checklist
Signed-off-by
line in the message. (more info)