From c576c003716851863c832b5e0dacb9186516f167 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 19 Jul 2023 23:50:14 +0300 Subject: Migrate to Twitter API 2.0 --- .../com/github/scribejava/apis/TwitterApi20.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/java/com/github/scribejava/apis/TwitterApi20.java (limited to 'src/main/java/com/github/scribejava/apis') 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 getAccessTokenExtractor() { + return OpenIdJsonTokenExtractor.instance(); + } + private static class InstanceHolder { + private static final TwitterApi20 INSTANCE = new TwitterApi20(); + + private InstanceHolder() { + } + } +} + -- cgit v1.2.3