-
-
Notifications
You must be signed in to change notification settings - Fork 12
Add OAuth2 scope constants and validation #8
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
Open
HolyGrail
wants to merge
2
commits into
unasuke:main
Choose a base branch
from
HolyGrail:feature/add-oauth2-scope-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add OAuth2 scope constants and validation #8
HolyGrail
wants to merge
2
commits into
unasuke:main
from
HolyGrail:feature/add-oauth2-scope-support
+124
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add AVAILABLE_SCOPES constant with all 20 supported X OAuth2 scopes - Add DEFAULT_SCOPE constant set to "tweet.read users.read" - Add authorize_params method for scope handling and validation - Add comprehensive test coverage for scope functionality - Include all scopes from official X API documentation: - users.email for email access - media.write for media upload - Ensure backward compatibility with existing implementations
- Document all 20 available OAuth2 scopes in README - Add usage examples for custom scope configuration - Update CHANGELOG with new features - Include descriptions for users.email and media.write scopes
7a3593a
to
0b6db25
Compare
unasuke
reviewed
Aug 3, 2025
Comment on lines
+4
to
+8
- Added `AVAILABLE_SCOPES` constant with all supported X (Twitter) OAuth 2.0 scopes | ||
- Added `DEFAULT_SCOPE` constant set to "tweet.read users.read" | ||
- Added default `authorize_params` with scope configuration | ||
- Added `authorize_params` method to handle scope validation and defaults | ||
- Added comprehensive documentation for available scopes in README |
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.
Suggested change
- Added `AVAILABLE_SCOPES` constant with all supported X (Twitter) OAuth 2.0 scopes | |
- Added `DEFAULT_SCOPE` constant set to "tweet.read users.read" | |
- Added default `authorize_params` with scope configuration | |
- Added `authorize_params` method to handle scope validation and defaults | |
- Added comprehensive documentation for available scopes in README | |
- Add OAuth2 scope constants and validation ([#8](https://github.com/unasuke/omniauth-twitter2/pull/8)) | |
- Added `AVAILABLE_SCOPES` constant with all supported X (Twitter) OAuth 2.0 scopes | |
- Added `DEFAULT_SCOPE` constant set to "tweet.read users.read" | |
- Added default `authorize_params` with scope configuration | |
- Added `authorize_params` method to handle scope validation and defaults | |
- Added comprehensive documentation for available scopes in README |
- Added comprehensive documentation for available scopes in README | ||
|
||
### Changed | ||
- Scope parameter is now explicitly handled with defaults and validation |
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.
Suggested change
- Scope parameter is now explicitly handled with defaults and validation | |
- Add OAuth2 scope constants and validation ([#8](https://github.com/unasuke/omniauth-twitter2/pull/8)) | |
- Scope parameter is now explicitly handled with defaults and validation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds explicit OAuth2 scope support to the omniauth-twitter2 strategy, providing constants and validation aligned with the official X (Twitter) API v2 documentation.
Motivation
The X API v2 OAuth2 implementation requires explicit scope definitions for proper authorization. This PR provides developers with:
Changes
Implementation
AVAILABLE_SCOPES
constant with all 20 OAuth2 scopes from the official X API documentationDEFAULT_SCOPE
constant set to"tweet.read users.read"
authorize_params
method to handle scope configuration and validationDocumentation
Testing
Backward Compatibility
This change is fully backward compatible:
Verification
References
Checklist