aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/github/scribejava/apis
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/github/scribejava/apis')
-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() {
+ }
+ }
+}
+