0
# OAuth 2.0 Provider APIs
1
2
OAuth 2.0 provider implementations for major social networks, cloud services, and enterprise identity providers. All OAuth 2.0 APIs extend `DefaultApi20` and follow the singleton pattern.
3
4
## Capabilities
5
6
### Google APIs
7
8
Google OAuth 2.0 API with OpenID Connect support, device authorization flow, and token revocation.
9
10
```java { .api }
11
public class GoogleApi20 extends DefaultApi20 {
12
public static GoogleApi20 instance();
13
public String getAccessTokenEndpoint(); // https://oauth2.googleapis.com/token
14
protected String getAuthorizationBaseUrl(); // https://accounts.google.com/o/oauth2/v2/auth
15
public String getRevokeTokenEndpoint(); // https://oauth2.googleapis.com/revoke
16
public String getDeviceAuthorizationEndpoint(); // https://oauth2.googleapis.com/device/code
17
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
18
public DeviceAuthorizationJsonExtractor getDeviceAuthorizationExtractor();
19
}
20
```
21
22
**Usage Example:**
23
```java
24
OAuth20Service service = new ServiceBuilder("client_id")
25
.apiSecret("client_secret")
26
.callback("callback_url")
27
.defaultScope("openid profile email")
28
.build(GoogleApi20.instance());
29
30
String authUrl = service.getAuthorizationUrl();
31
// After user authorization...
32
OAuth2AccessToken token = service.getAccessToken("authorization_code");
33
```
34
35
### Facebook API
36
37
Facebook OAuth 2.0 API with custom version support and specialized service for app secret proof.
38
39
```java { .api }
40
public class FacebookApi extends DefaultApi20 {
41
public static FacebookApi instance(); // Default version 3.2
42
public static FacebookApi customVersion(String version);
43
public String getAccessTokenEndpoint(); // https://graph.facebook.com/v{version}/oauth/access_token
44
protected String getAuthorizationBaseUrl(); // https://www.facebook.com/v{version}/dialog/oauth
45
public String getRefreshTokenEndpoint(); // Throws UnsupportedOperationException
46
public Verb getAccessTokenVerb(); // GET
47
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
48
public ClientAuthentication getClientAuthentication();
49
public FacebookService createService(...); // Returns specialized service
50
}
51
```
52
53
**Usage Example:**
54
```java
55
// Default Facebook API (version 3.2)
56
OAuth20Service service = new ServiceBuilder("app_id")
57
.apiSecret("app_secret")
58
.callback("callback_url")
59
.build(FacebookApi.instance());
60
61
// Custom Facebook API version
62
OAuth20Service service = new ServiceBuilder("app_id")
63
.apiSecret("app_secret")
64
.callback("callback_url")
65
.build(FacebookApi.customVersion("15.0"));
66
```
67
68
### GitHub API
69
70
GitHub OAuth 2.0 API for GitHub application authentication.
71
72
```java { .api }
73
public class GitHubApi extends DefaultApi20 {
74
public static GitHubApi instance();
75
public String getAccessTokenEndpoint(); // https://github.com/login/oauth/access_token
76
protected String getAuthorizationBaseUrl(); // https://github.com/login/oauth/authorize
77
public Verb getAccessTokenVerb(); // POST
78
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
79
}
80
```
81
82
### LinkedIn APIs
83
84
LinkedIn OAuth 2.0 API for professional network integration.
85
86
```java { .api }
87
public class LinkedInApi20 extends DefaultApi20 {
88
public static LinkedInApi20 instance();
89
public String getAccessTokenEndpoint(); // https://www.linkedin.com/oauth/v2/accessToken
90
protected String getAuthorizationBaseUrl(); // https://www.linkedin.com/oauth/v2/authorization
91
public ClientAuthentication getClientAuthentication();
92
}
93
```
94
95
### Microsoft Azure Active Directory APIs
96
97
Microsoft Azure AD OAuth 2.0 APIs for enterprise authentication.
98
99
```java { .api }
100
public class MicrosoftAzureActiveDirectory20Api extends BaseMicrosoftAzureActiveDirectoryApi {
101
public static MicrosoftAzureActiveDirectory20Api instance(); // Common tenant
102
public static MicrosoftAzureActiveDirectory20Api custom(String tenant); // Custom tenant
103
public String getAccessTokenEndpoint(); // https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
104
protected String getAuthorizationBaseUrl(); // https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize
105
public ClientAuthentication getClientAuthentication();
106
public BearerSignature getBearerSignature();
107
}
108
109
public class MicrosoftAzureActiveDirectoryApi extends BaseMicrosoftAzureActiveDirectoryApi {
110
public static MicrosoftAzureActiveDirectoryApi instance(); // Common tenant
111
public static MicrosoftAzureActiveDirectoryApi customTenant(String tenant);
112
public static MicrosoftAzureActiveDirectoryApi customResource(String resource);
113
public static MicrosoftAzureActiveDirectoryApi custom(String tenant, String resource);
114
public String getAccessTokenEndpoint(); // https://login.microsoftonline.com/{tenant}/oauth2/token
115
protected String getAuthorizationBaseUrl(); // Dynamic with resource parameter
116
public BearerSignature getBearerSignature();
117
}
118
```
119
120
### Social Media APIs
121
122
Popular social media platform OAuth 2.0 APIs.
123
124
```java { .api }
125
public class InstagramApi extends DefaultApi20 {
126
public static InstagramApi instance();
127
public String getAccessTokenEndpoint(); // https://api.instagram.com/oauth/access_token
128
protected String getAuthorizationBaseUrl(); // https://api.instagram.com/oauth/authorize
129
public Verb getAccessTokenVerb(); // POST
130
}
131
132
public class SlackApi extends DefaultApi20 {
133
public static SlackApi instance();
134
public String getAccessTokenEndpoint(); // https://slack.com/api/oauth.access
135
protected String getAuthorizationBaseUrl(); // https://slack.com/oauth/authorize
136
public Verb getAccessTokenVerb(); // POST
137
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
138
}
139
140
public class DiscordApi extends DefaultApi20 {
141
public static DiscordApi instance();
142
public String getAccessTokenEndpoint(); // https://discord.com/api/oauth2/token
143
protected String getAuthorizationBaseUrl(); // https://discord.com/api/oauth2/authorize
144
public ClientAuthentication getClientAuthentication();
145
}
146
147
public class VkontakteApi extends DefaultApi20 {
148
public static VkontakteApi instance();
149
public String getAccessTokenEndpoint(); // https://oauth.vk.com/access_token
150
protected String getAuthorizationBaseUrl(); // https://oauth.vk.com/authorize
151
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
152
}
153
```
154
155
### Cloud Storage APIs
156
157
Cloud storage and file sharing service OAuth 2.0 APIs.
158
159
```java { .api }
160
public class BoxApi20 extends DefaultApi20 {
161
public static BoxApi20 instance();
162
public String getAccessTokenEndpoint(); // https://api.box.com/oauth2/token
163
protected String getAuthorizationBaseUrl(); // https://account.box.com/api/oauth2/authorize
164
public ClientAuthentication getClientAuthentication();
165
}
166
167
public class DropboxApi extends DefaultApi20 {
168
public static DropboxApi instance();
169
public String getAccessTokenEndpoint(); // https://api.dropboxapi.com/oauth2/token
170
protected String getAuthorizationBaseUrl(); // https://www.dropbox.com/oauth2/authorize
171
public ClientAuthentication getClientAuthentication();
172
}
173
174
public class ImgurApi extends DefaultApi20 {
175
public static ImgurApi instance();
176
public String getAccessTokenEndpoint(); // https://api.imgur.com/oauth2/token
177
protected String getAuthorizationBaseUrl(); // https://api.imgur.com/oauth2/authorize
178
public ClientAuthentication getClientAuthentication();
179
}
180
```
181
182
### Business and Productivity APIs
183
184
Enterprise and productivity platform OAuth 2.0 APIs.
185
186
```java { .api }
187
public class SalesforceApi extends DefaultApi20 {
188
public static SalesforceApi instance(); // Production environment
189
public static SalesforceApi sandbox(); // Sandbox environment
190
public String getAccessTokenEndpoint(); // Dynamic based on production/sandbox
191
protected String getAuthorizationBaseUrl(); // Dynamic based on production/sandbox
192
public Verb getAccessTokenVerb(); // POST
193
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor(); // Returns SalesforceToken
194
public ClientAuthentication getClientAuthentication();
195
196
// Static utility method for TLS configuration
197
public static void initTLSv11orUpper() throws NoSuchAlgorithmException, KeyManagementException, IOException;
198
}
199
200
public class Asana20Api extends DefaultApi20 {
201
public static Asana20Api instance();
202
public String getAccessTokenEndpoint(); // https://app.asana.com/-/oauth_token
203
protected String getAuthorizationBaseUrl(); // https://app.asana.com/-/oauth_authorize
204
public ClientAuthentication getClientAuthentication();
205
}
206
207
public class KeycloakApi extends DefaultApi20 {
208
public static KeycloakApi instance();
209
// Note: Requires configuration for specific Keycloak instance
210
}
211
```
212
213
### Health and Fitness APIs
214
215
Health and fitness platform OAuth 2.0 APIs.
216
217
```java { .api }
218
public class FitbitApi20 extends DefaultApi20 {
219
public static FitbitApi20 instance();
220
public String getAccessTokenEndpoint(); // https://api.fitbit.com/oauth2/token
221
protected String getAuthorizationBaseUrl(); // https://www.fitbit.com/oauth2/authorize
222
public ClientAuthentication getClientAuthentication();
223
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
224
}
225
226
public class PolarAPI extends DefaultApi20 {
227
public static PolarAPI instance();
228
public String getAccessTokenEndpoint(); // https://polarremote.com/v2/oauth2/token
229
protected String getAuthorizationBaseUrl(); // https://flow.polar.com/oauth2/authorization
230
public ClientAuthentication getClientAuthentication();
231
public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor();
232
}
233
```
234
235
### Regional and Specialized APIs
236
237
Region-specific and specialized platform OAuth 2.0 APIs.
238
239
```java { .api }
240
public class MailruApi extends DefaultApi20 {
241
public static MailruApi instance();
242
public String getAccessTokenEndpoint(); // https://oauth.mail.ru/token
243
protected String getAuthorizationBaseUrl(); // https://oauth.mail.ru/login
244
public ClientAuthentication getClientAuthentication();
245
}
246
247
public class OdnoklassnikiApi extends DefaultApi20 {
248
public static OdnoklassnikiApi instance();
249
public String getAccessTokenEndpoint(); // https://api.odnoklassniki.ru/oauth/token.do
250
protected String getAuthorizationBaseUrl(); // https://connect.ok.ru/oauth/authorize
251
public ClientAuthentication getClientAuthentication();
252
}
253
254
public class KakaoApi extends DefaultApi20 {
255
public static KakaoApi instance();
256
public String getAccessTokenEndpoint(); // https://kauth.kakao.com/oauth/token
257
protected String getAuthorizationBaseUrl(); // https://kauth.kakao.com/oauth/authorize
258
public ClientAuthentication getClientAuthentication();
259
}
260
261
public class NaverApi extends DefaultApi20 {
262
public static NaverApi instance();
263
public String getAccessTokenEndpoint(); // https://nid.naver.com/oauth2.0/token
264
protected String getAuthorizationBaseUrl(); // https://nid.naver.com/oauth2.0/authorize
265
public ClientAuthentication getClientAuthentication();
266
}
267
```
268
269
## Complete Provider List
270
271
### OAuth 2.0 Providers (50+ providers)
272
273
All extend `DefaultApi20` and use `instance()` singleton pattern:
274
275
- `Asana20Api` - Asana project management
276
- `AutomaticAPI` - Automatic car tracking
277
- `BoxApi20` - Box cloud storage
278
- `DataportenApi` - Dataporten identity provider
279
- `DiscordApi` - Discord chat platform
280
- `DoktornaraboteApi` - Doktornarabote job platform
281
- `DropboxApi` - Dropbox cloud storage
282
- `FacebookApi` - Facebook social network
283
- `FitbitApi20` - Fitbit fitness tracking
284
- `Foursquare2Api` - Foursquare location services
285
- `FrappeApi` - Frappe framework
286
- `FreelancerApi` - Freelancer job platform
287
- `GeniusApi` - Genius lyrics platform
288
- `GitHubApi` - GitHub code hosting
289
- `GoogleApi20` - Google services
290
- `HHApi` - HeadHunter job platform
291
- `HiOrgServerApi20` - HiOrg emergency services
292
- `ImgurApi` - Imgur image hosting
293
- `InstagramApi` - Instagram photo sharing
294
- `KaixinApi20` - Kaixin social network
295
- `KakaoApi` - Kakao Korean platform
296
- `KeycloakApi` - Keycloak identity management
297
- `LinkedInApi20` - LinkedIn professional network
298
- `LiveApi` - Microsoft Live services
299
- `MailruApi` - Mail.ru Russian services
300
- `MediaWikiApi` - MediaWiki platforms
301
- `MeetupApi20` - Meetup event platform
302
- `MicrosoftAzureActiveDirectory20Api` - Modern Azure AD
303
- `MicrosoftAzureActiveDirectoryApi` - Legacy Azure AD
304
- `MisfitApi` - Misfit fitness tracking
305
- `NaverApi` - Naver Korean services
306
- `OdnoklassnikiApi` - Odnoklassniki Russian social network
307
- `PinterestApi` - Pinterest image platform
308
- `PolarAPI` - Polar fitness tracking
309
- `Px500Api` - 500px photography platform
310
- `RenrenApi` - Renren Chinese social network
311
- `SalesforceApi` - Salesforce CRM
312
- `SinaWeiboApi20` - Sina Weibo Chinese microblog
313
- `SkyrockApi` - Skyrock blogging platform
314
- `SlackApi` - Slack team communication
315
- `StackExchangeApi` - Stack Exchange Q&A network
316
- `TheThingsNetworkV1StagingApi` - IoT network (V1 staging)
317
- `TheThingsNetworkV2PreviewApi` - IoT network (V2 preview)
318
- `TutByApi` - Tut.by Belarusian portal
319
- `UcozApi` - uCoz website builder
320
- `VkontakteApi` - VKontakte Russian social network
321
- `WunderlistAPI` - Wunderlist task management
322
- `XeroApi20` - Xero accounting software
323
- `YahooApi20` - Yahoo services
324
325
## Common Usage Patterns
326
327
### Standard OAuth 2.0 Flow
328
```java
329
// 1. Create service
330
OAuth20Service service = new ServiceBuilder("client_id")
331
.apiSecret("client_secret")
332
.callback("http://localhost:8080/callback")
333
.defaultScope("read write")
334
.build(ProviderApi.instance());
335
336
// 2. Get authorization URL
337
String authUrl = service.getAuthorizationUrl();
338
339
// 3. Exchange code for token
340
OAuth2AccessToken token = service.getAccessToken("authorization_code");
341
342
// 4. Make authenticated requests
343
OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.provider.com/user");
344
service.signRequest(token.getAccessToken(), request);
345
Response response = service.execute(request);
346
```
347
348
### Token Refresh
349
```java
350
// For providers that support token refresh
351
if (token.getRefreshToken() != null) {
352
OAuth2AccessToken newToken = service.refreshAccessToken(token.getRefreshToken());
353
}
354
```
355
356
### Device Authorization Flow (Google)
357
```java
358
// Supported by GoogleApi20
359
DeviceAuthorization deviceAuth = service.getDeviceAuthorization();
360
System.out.println("Go to: " + deviceAuth.getVerificationUriComplete());
361
OAuth2AccessToken token = service.pollAccessToken(deviceAuth);
362
```