Skip to content

Commit a35f93f

Browse files
authored
Java OAuth refactors (#7239)
1 parent dfdbda8 commit a35f93f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

airbyte-oauth/src/main/java/io/airbyte/oauth/OAuthImplementationFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import com.google.common.collect.ImmutableMap;
88
import io.airbyte.config.persistence.ConfigRepository;
99
import io.airbyte.oauth.flows.AsanaOAuthFlow;
10-
import io.airbyte.oauth.flows.SalesforceOAuthFlow;
1110
import io.airbyte.oauth.flows.FacebookMarketingOAuthFlow;
11+
import io.airbyte.oauth.flows.SalesforceOAuthFlow;
1212
import io.airbyte.oauth.flows.TrelloOAuthFlow;
1313
import io.airbyte.oauth.flows.google.GoogleAdsOAuthFlow;
1414
import io.airbyte.oauth.flows.google.GoogleAnalyticsOAuthFlow;

airbyte-oauth/src/main/java/io/airbyte/oauth/flows/SalesforceOAuthFlow.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
import org.apache.http.client.utils.URIBuilder;
2020

2121
/**
22-
* Following docs from https://help.salesforce.com/s/articleView?language=en_US&id=sf.remoteaccess_oauth_web_server_flow.htm
22+
* Following docs from
23+
* https://help.salesforce.com/s/articleView?language=en_US&id=sf.remoteaccess_oauth_web_server_flow.htm
2324
*/
2425
public class SalesforceOAuthFlow extends BaseOAuthFlow {
2526

@@ -50,7 +51,7 @@ protected String formatConsentUrl(UUID definitionId, String clientId, String red
5051
}
5152

5253
@Override
53-
protected String getAccessTokenUrl() {
54+
protected String getAccessTokenUrl(JsonNode oAuthConfig) {
5455
return ACCESS_TOKEN_URL;
5556
}
5657

@@ -63,13 +64,13 @@ protected Map<String, String> getAccessTokenQueryParameters(String clientId, Str
6364
}
6465

6566
@Override
66-
protected Map<String, Object> extractRefreshToken(JsonNode data) throws IOException {
67+
protected Map<String, Object> extractRefreshToken(JsonNode data, String accessTokenUrl) throws IOException {
6768
System.out.println(Jsons.serialize(data));
6869
if (data.has("refresh_token")) {
6970
final String refreshToken = data.get("refresh_token").asText();
7071
return Map.of("refresh_token", refreshToken);
7172
} else {
72-
throw new IOException(String.format("Missing 'refresh_token' in query params from %s", ACCESS_TOKEN_URL));
73+
throw new IOException(String.format("Missing 'refresh_token' in query params from %s", accessTokenUrl));
7374
}
7475
}
7576

0 commit comments

Comments
 (0)