or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

custom-tokens.mdindex.mdoauth1a-providers.mdoauth2-providers.mdspecialized-services.mdtoken-extractors.md

specialized-services.mddocs/

0

# Specialized Services

1

2

Custom OAuth service implementations that extend the base OAuth functionality with provider-specific features like additional security measures, custom signature requirements, and specialized token handling.

3

4

## Capabilities

5

6

### Facebook Service

7

8

Facebook-specific OAuth service that adds app secret proof to all authenticated requests for enhanced security.

9

10

```java { .api }

11

public class FacebookService extends OAuth20Service {

12

public FacebookService(FacebookApi api, String apiKey, String apiSecret,

13

String callback, String defaultScope, String responseType,

14

OutputStream debugStream, String userAgent,

15

HttpClientConfig httpClientConfig, HttpClient httpClient);

16

17

public void signRequest(String accessToken, OAuthRequest request);

18

}

19

```

20

21

The Facebook service automatically adds the `appsecret_proof` parameter to all requests, which is calculated as HMAC-SHA256 of the access token using the app secret as the key.

22

23

**Usage Example:**

24

```java

25

// FacebookApi automatically creates FacebookService

26

OAuth20Service service = new ServiceBuilder("app_id")

27

.apiSecret("app_secret")

28

.callback("callback_url")

29

.build(FacebookApi.instance());

30

31

// When making requests, appsecret_proof is automatically added

32

OAuthRequest request = new OAuthRequest(Verb.GET, "https://graph.facebook.com/me");

33

service.signRequest(accessToken.getAccessToken(), request);

34

// Request will include: appsecret_proof=<hmac_sha256_signature>

35

```

36

37

### Instagram Service

38

39

Instagram-specific OAuth service for Instagram API integration.

40

41

```java { .api }

42

public class InstagramService extends OAuth20Service {

43

public InstagramService(InstagramApi api, String apiKey, String apiSecret,

44

String callback, String defaultScope, String responseType,

45

OutputStream debugStream, String userAgent,

46

HttpClientConfig httpClientConfig, HttpClient httpClient);

47

}

48

```

49

50

**Usage Example:**

51

```java

52

// InstagramApi creates InstagramService automatically

53

OAuth20Service service = new ServiceBuilder("client_id")

54

.apiSecret("client_secret")

55

.callback("callback_url")

56

.build(InstagramApi.instance());

57

```

58

59

### Mail.ru OAuth Service

60

61

Mail.ru-specific OAuth service that adds signature parameter for API requests.

62

63

```java { .api }

64

public class MailruOAuthService extends OAuth20Service {

65

public MailruOAuthService(MailruApi api, String apiKey, String apiSecret,

66

String callback, String defaultScope, String responseType,

67

OutputStream debugStream, String userAgent,

68

HttpClientConfig httpClientConfig, HttpClient httpClient);

69

70

public void signRequest(String accessToken, OAuthRequest request);

71

}

72

```

73

74

The Mail.ru service automatically adds a signature parameter to requests based on Mail.ru's API requirements.

75

76

**Usage Example:**

77

```java

78

// MailruApi creates MailruOAuthService automatically

79

OAuth20Service service = new ServiceBuilder("client_id")

80

.apiSecret("client_secret")

81

.callback("callback_url")

82

.build(MailruApi.instance());

83

84

// Signature is automatically added to requests

85

OAuthRequest request = new OAuthRequest(Verb.GET, "https://www.appsmail.ru/platform/api");

86

service.signRequest(accessToken.getAccessToken(), request);

87

```

88

89

### Polar OAuth Service

90

91

Polar-specific OAuth service for Polar fitness platform integration.

92

93

```java { .api }

94

public class PolarOAuthService extends OAuth20Service {

95

public PolarOAuthService(PolarAPI api, String apiKey, String apiSecret,

96

String callback, String defaultScope, String responseType,

97

OutputStream debugStream, String userAgent,

98

HttpClientConfig httpClientConfig, HttpClient httpClient);

99

}

100

```

101

102

**Usage Example:**

103

```java

104

// PolarAPI creates PolarOAuthService automatically

105

OAuth20Service service = new ServiceBuilder("client_id")

106

.apiSecret("client_secret")

107

.callback("callback_url")

108

.build(PolarAPI.instance());

109

```

110

111

### Wunderlist OAuth Service

112

113

Wunderlist-specific OAuth service for Wunderlist task management integration.

114

115

```java { .api }

116

public class WunderlistOAuthService extends OAuth20Service {

117

public WunderlistOAuthService(WunderlistAPI api, String apiKey, String apiSecret,

118

String callback, String defaultScope, String responseType,

119

OutputStream debugStream, String userAgent,

120

HttpClientConfig httpClientConfig, HttpClient httpClient);

121

}

122

```

123

124

**Usage Example:**

125

```java

126

// WunderlistAPI creates WunderlistOAuthService automatically

127

OAuth20Service service = new ServiceBuilder("client_id")

128

.apiSecret("client_secret")

129

.callback("callback_url")

130

.build(WunderlistAPI.instance());

131

```

132

133

### Imgur OAuth Service

134

135

Imgur-specific OAuth service for Imgur image hosting integration.

136

137

```java { .api }

138

public class ImgurOAuthService extends OAuth20Service {

139

public ImgurOAuthService(ImgurApi api, String apiKey, String apiSecret,

140

String callback, String defaultScope, String responseType,

141

OutputStream debugStream, String userAgent,

142

HttpClientConfig httpClientConfig, HttpClient httpClient);

143

}

144

```

145

146

**Usage Example:**

147

```java

148

// ImgurApi creates ImgurOAuthService automatically

149

OAuth20Service service = new ServiceBuilder("client_id")

150

.apiSecret("client_secret")

151

.callback("callback_url")

152

.build(ImgurApi.instance());

153

```

154

155

### Odnoklassniki OAuth Service

156

157

Odnoklassniki-specific OAuth service that adds signature parameter for Russian social network API.

158

159

```java { .api }

160

public class OdnoklassnikiOAuthService extends OAuth20Service {

161

public OdnoklassnikiOAuthService(OdnoklassnikiApi api, String apiKey, String apiSecret,

162

String callback, String defaultScope, String responseType,

163

OutputStream debugStream, String userAgent,

164

HttpClientConfig httpClientConfig, HttpClient httpClient);

165

166

public void signRequest(String accessToken, OAuthRequest request);

167

}

168

```

169

170

The Odnoklassniki service automatically adds a signature parameter to requests based on Odnoklassniki's API security requirements.

171

172

**Usage Example:**

173

```java

174

// OdnoklassnikiApi creates OdnoklassnikiOAuthService automatically

175

OAuth20Service service = new ServiceBuilder("application_key")

176

.apiSecret("secret_key")

177

.callback("callback_url")

178

.build(OdnoklassnikiApi.instance());

179

180

// Signature is automatically added to requests

181

OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.odnoklassniki.ru/fb.do");

182

service.signRequest(accessToken.getAccessToken(), request);

183

```

184

185

## Service Creation

186

187

Specialized services are automatically created when using the corresponding API classes through the `createService()` method override:

188

189

```java { .api }

190

// Base API method that specialized APIs override

191

public OAuth20Service createService(String apiKey, String apiSecret, String callback,

192

String defaultScope, String responseType,

193

OutputStream debugStream, String userAgent,

194

HttpClientConfig httpClientConfig, HttpClient httpClient);

195

```

196

197

## Key Features

198

199

### Enhanced Security

200

- **Facebook**: Adds `appsecret_proof` parameter using HMAC-SHA256 signature

201

- **Mail.ru**: Adds signature parameter for API request validation

202

- **Odnoklassniki**: Adds signature parameter for Russian API compliance

203

204

### Provider-Specific Handling

205

- **Instagram**: Handles Instagram's specific OAuth flow requirements

206

- **Polar**: Manages Polar fitness platform's API specifics

207

- **Wunderlist**: Handles Wunderlist task management API requirements

208

- **Imgur**: Manages Imgur image hosting API specifics

209

210

### Transparent Usage

211

All specialized services maintain the same `OAuth20Service` interface, so they can be used exactly like standard OAuth services. The provider-specific functionality is applied automatically when signing requests.

212

213

## Common Pattern

214

215

```java

216

// All specialized services follow this pattern:

217

OAuth20Service service = new ServiceBuilder("client_id")

218

.apiSecret("client_secret")

219

.callback("callback_url")

220

.build(SpecializedApi.instance()); // Returns specialized service automatically

221

222

// Standard OAuth flow works the same

223

String authUrl = service.getAuthorizationUrl();

224

OAuth2AccessToken token = service.getAccessToken("authorization_code");

225

226

// Provider-specific features are applied automatically

227

OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.provider.com/endpoint");

228

service.signRequest(token.getAccessToken(), request); // Specialized signing applied here

229

Response response = service.execute(request);

230

```