aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/github/scribejava
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-07-19 23:50:14 +0300
committerGravatar Vitaly Takmazov2023-07-19 23:59:40 +0300
commitc576c003716851863c832b5e0dacb9186516f167 (patch)
tree420c517806d28db3c8f448eacbc3d61f01106629 /src/main/java/com/github/scribejava
parent128753a9bd11e09940d58d97c67db59a15251b71 (diff)
Migrate to Twitter API 2.0
Diffstat (limited to 'src/main/java/com/github/scribejava')
-rw-r--r--src/main/java/com/github/scribejava/apis/TwitterApi20.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/com/github/scribejava/apis/TwitterApi20.java b/src/main/java/com/github/scribejava/apis/TwitterApi20.java
new file mode 100644
index 00000000..c34a246e
--- /dev/null
+++ b/src/main/java/com/github/scribejava/apis/TwitterApi20.java
@@ -0,0 +1,37 @@
+package com.github.scribejava.apis;
+
+import com.github.scribejava.apis.openid.OpenIdJsonTokenExtractor;
+import com.github.scribejava.core.builder.api.DefaultApi20;
+import com.github.scribejava.core.extractors.TokenExtractor;
+import com.github.scribejava.core.model.OAuth2AccessToken;
+
+public class TwitterApi20 extends DefaultApi20 {
+ private static final String AUTHORIZE_URL = "https://twitter.com/i/oauth2/authorize";
+ private static final String ACCESS_TOKEN_RESOURCE = "https://api.twitter.com/2/oauth2/token";
+
+ protected TwitterApi20() {
+ }
+
+ public static TwitterApi20 instance() {
+ return TwitterApi20.InstanceHolder.INSTANCE;
+ }
+
+ public String getAccessTokenEndpoint() {
+ return ACCESS_TOKEN_RESOURCE;
+ }
+
+ public String getAuthorizationBaseUrl() {
+ return AUTHORIZE_URL;
+ }
+
+ public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor() {
+ return OpenIdJsonTokenExtractor.instance();
+ }
+ private static class InstanceHolder {
+ private static final TwitterApi20 INSTANCE = new TwitterApi20();
+
+ private InstanceHolder() {
+ }
+ }
+}
+