@@ -33,7 +33,46 @@ $ gem install omniauth-twitter2
3333``` ruby
3434# config/initializers/omniauth.rb
3535Rails .application.config.middleware.use OmniAuth ::Builder do
36- provider :twitter2 , ENV [" TWITTER_CLIENT_ID" ], ENV [" TWITTER_CLIENT_SECRET" ], callback_path: ' /auth/twitter2/callback' , scope: " tweet.read users.read"
36+ provider :twitter2 , ENV [" TWITTER_CLIENT_ID" ], ENV [" TWITTER_CLIENT_SECRET" ],
37+ callback_path: ' /auth/twitter2/callback' ,
38+ scope: " tweet.read users.read" # Default scope
39+ end
40+ ```
41+
42+ ### Available Scopes
43+
44+ The following OAuth 2.0 scopes are available for X (Twitter) API v2:
45+
46+ - ` tweet.read ` - All the Tweets you can view, including Tweets from protected accounts.
47+ - ` tweet.write ` - Tweet and Retweet for you.
48+ - ` tweet.moderate.write ` - Hide and unhide replies to your Tweets.
49+ - ` users.email ` - Email from an authenticated user.
50+ - ` users.read ` - Any account you can view, including protected accounts.
51+ - ` follows.read ` - People who follow you and people who you follow.
52+ - ` follows.write ` - Follow and unfollow people for you.
53+ - ` offline.access ` - Stay connected to your account until you revoke access.
54+ - ` space.read ` - All the Spaces you can view.
55+ - ` mute.read ` - Accounts you've muted.
56+ - ` mute.write ` - Mute and unmute accounts for you.
57+ - ` like.read ` - Tweets you've liked and likes you can view.
58+ - ` like.write ` - Like and un-like Tweets for you.
59+ - ` list.read ` - Lists, list members, and list followers of lists you've created or are a member of, including private lists.
60+ - ` list.write ` - Create and manage Lists for you.
61+ - ` block.read ` - Accounts you've blocked.
62+ - ` block.write ` - Block and unblock accounts for you.
63+ - ` bookmark.read ` - Get Bookmarked Tweets from an authenticated user.
64+ - ` bookmark.write ` - Bookmark and remove Bookmarks from Tweets.
65+ - ` media.write ` - Upload media.
66+
67+ Default scope is ` "tweet.read users.read" ` if not specified.
68+
69+ You can customize the scope like this:
70+
71+ ``` ruby
72+ Rails .application.config.middleware.use OmniAuth ::Builder do
73+ provider :twitter2 , ENV [" TWITTER_CLIENT_ID" ], ENV [" TWITTER_CLIENT_SECRET" ],
74+ callback_path: ' /auth/twitter2/callback' ,
75+ scope: " tweet.read tweet.write users.read offline.access"
3776end
3877```
3978
0 commit comments