aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/github/scribejava/apis/TwitterApi20.java
blob: c34a246edb7e1b7d358eef938bf80e4f8d0ba7cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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() {
        }
    }
}