twitter_oauth2 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.github/workflows/spec.yml +30 -0
- data/README.md +20 -1
- data/VERSION +1 -1
- data/lib/twitter_oauth2/client.rb +3 -2
- metadata +5 -7
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84ffe5c37d326db1fd143e57c6089f4dc67fe7c25ed595c44866930799ce86b0
|
4
|
+
data.tar.gz: e1317eb4c37d5f7b870b0aac4b121f96ed0b1c15864f7eb5304c9e36038277b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba77abdda442c899be41b8a2e3dfcb009a51bc7b2a46ca6d5469b9f96174841f2a791321590fa4fc3080a0df0ba3ad04ee0c439e31a4111f2a53bfb62616f04
|
7
|
+
data.tar.gz: 27c92e3bf78a1467b05ad56b8c8f4cfe9eb56866e53a30c2d521b94ebfc0ceea23cf580bcb3e489688c632b78904b4578714df1bda8662f67069347becd39f0e
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Spec
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
permissions:
|
8
|
+
contents: read
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
spec:
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
os: ['ubuntu-20.04']
|
15
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
|
16
|
+
# ubuntu 22.04 only supports ssl 3 and thus only ruby 3.1
|
17
|
+
include:
|
18
|
+
- os: 'ubuntu-22.04'
|
19
|
+
ruby-version: '3.1'
|
20
|
+
runs-on: ${{ matrix.os }}
|
21
|
+
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v3
|
24
|
+
- name: Set up Ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby-version }}
|
28
|
+
bundler-cache: true
|
29
|
+
- name: Run Specs
|
30
|
+
run: bundle exec rake spec
|
data/README.md
CHANGED
@@ -29,7 +29,8 @@ The only difference is that this gem is supporting PKCE as default, since [Twitt
|
|
29
29
|
require 'twitter_oauth2'
|
30
30
|
|
31
31
|
client = TwitterOAuth2::Client.new(
|
32
|
-
identifier:
|
32
|
+
identifier: '<YOUR-CLIENT-ID>',
|
33
|
+
secret: '<YOUR-CLIENT-SECRET>',
|
33
34
|
redirect_uri: '<YOUR-CALLBACK-URL>'
|
34
35
|
)
|
35
36
|
|
@@ -38,6 +39,7 @@ authorization_uri = client.authorization_uri(
|
|
38
39
|
:'users.read',
|
39
40
|
:'tweet.read',
|
40
41
|
:'offline.access'
|
42
|
+
]
|
41
43
|
)
|
42
44
|
|
43
45
|
# NOTE:
|
@@ -63,6 +65,23 @@ client.refresh_token = token_response.refresh_token
|
|
63
65
|
client.access_token!
|
64
66
|
```
|
65
67
|
|
68
|
+
If you want to get App-only Bearer Token (via `grant_type=client_credentials`), you need some tweaks as below.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
require 'twitter_oauth2'
|
72
|
+
|
73
|
+
client = TwitterOAuth2::Client.new(
|
74
|
+
# NOTE: not OAuth 2.0 Client ID, but OAuth 1.0 Consumer Key (a.k.a API Key)
|
75
|
+
identifier: '<YOUR-CONSUMER-KEY>',
|
76
|
+
# NOTE: not OAuth 2.0 Client Secret, but OAuth 1.0 Consumer Secret (a.k.a API Key Secret)
|
77
|
+
secret: '<YOUR-CONSUMER-SECRET>'
|
78
|
+
# NOTE: Twitter has Client Credentials Grant specific token endpoint.
|
79
|
+
token_endpoint: '/oauth2/token',
|
80
|
+
)
|
81
|
+
|
82
|
+
client.access_token!
|
83
|
+
```
|
84
|
+
|
66
85
|
For more usage, read [the underling gem's wiki](https://github.com/nov/rack-oauth2/wiki).
|
67
86
|
|
68
87
|
## Development
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
@@ -4,15 +4,16 @@ module TwitterOAuth2
|
|
4
4
|
|
5
5
|
def initialize(attributes)
|
6
6
|
attributes_with_default = {
|
7
|
+
host: 'api.twitter.com',
|
7
8
|
authorization_endpoint: 'https://twitter.com/i/oauth2/authorize',
|
8
|
-
token_endpoint: '
|
9
|
+
token_endpoint: '/2/oauth2/token'
|
9
10
|
}.merge(attributes)
|
10
11
|
super attributes_with_default
|
11
12
|
end
|
12
13
|
|
13
14
|
def authorization_uri(params = {})
|
14
15
|
authorization_session!
|
15
|
-
|
16
|
+
super({
|
16
17
|
code_challenge: code_challenge,
|
17
18
|
code_challenge_method: code_challenge_method,
|
18
19
|
state: state
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rack-oauth2
|
@@ -115,9 +114,10 @@ executables: []
|
|
115
114
|
extensions: []
|
116
115
|
extra_rdoc_files: []
|
117
116
|
files:
|
117
|
+
- ".github/FUNDING.yml"
|
118
|
+
- ".github/workflows/spec.yml"
|
118
119
|
- ".gitignore"
|
119
120
|
- ".rspec"
|
120
|
-
- ".travis.yml"
|
121
121
|
- CODE_OF_CONDUCT.md
|
122
122
|
- Gemfile
|
123
123
|
- LICENSE.txt
|
@@ -133,7 +133,6 @@ homepage: https://github.com/nov/twitter_oauth2
|
|
133
133
|
licenses:
|
134
134
|
- MIT
|
135
135
|
metadata: {}
|
136
|
-
post_install_message:
|
137
136
|
rdoc_options: []
|
138
137
|
require_paths:
|
139
138
|
- lib
|
@@ -148,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
147
|
- !ruby/object:Gem::Version
|
149
148
|
version: '0'
|
150
149
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
-
signing_key:
|
150
|
+
rubygems_version: 3.6.7
|
153
151
|
specification_version: 4
|
154
152
|
summary: Twitter OAuth 2.0 Client
|
155
153
|
test_files: []
|