-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OAuth2 scope support #156
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 3461f7c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -38,22 +38,22 @@ | |||
* | |||
* @packageDocumentation | |||
*/ | |||
import type { v1 } from "@standard-schema/spec" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These got reordered because of Organize Imports
. Let me know if you want me to revert this part.
* } | ||
* ``` | ||
*/ | ||
scopes_supported?: string[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also be a good place to add default_scopes
or so, which would be used if the auth request has no scope
.
.changeset/new-donuts-tap.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is right. Haven't used this before either.
Fixes #5
First time contributing and new to bun/hono, so let me know if something is out of style. Particularly not sure about usage of
test.each
for testing with and without scopes.The OAuth2 spec is pretty thin wrt
scope
. In particular, the corner cases seem to differ between implementations. For this PR, I've considered the absence ofscope
different from the empty scope, ie.&scope=
. Additionally, in the token/refresh request I ignore scopes that were not part of the auth request, instead of for example returninginvalid_scope
error.Since the resource server will have to check the issued scopes, I've added
scopes
to the JWT, iffscope
was specified in the auth request.