Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java OAuth refactors #7239

Merged
merged 1 commit into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.google.common.collect.ImmutableMap;
import io.airbyte.config.persistence.ConfigRepository;
import io.airbyte.oauth.flows.AsanaOAuthFlow;
import io.airbyte.oauth.flows.SalesforceOAuthFlow;
import io.airbyte.oauth.flows.FacebookMarketingOAuthFlow;
import io.airbyte.oauth.flows.SalesforceOAuthFlow;
import io.airbyte.oauth.flows.TrelloOAuthFlow;
import io.airbyte.oauth.flows.google.GoogleAdsOAuthFlow;
import io.airbyte.oauth.flows.google.GoogleAnalyticsOAuthFlow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import org.apache.http.client.utils.URIBuilder;

/**
* Following docs from https://help.salesforce.com/s/articleView?language=en_US&id=sf.remoteaccess_oauth_web_server_flow.htm
* Following docs from
* https://help.salesforce.com/s/articleView?language=en_US&id=sf.remoteaccess_oauth_web_server_flow.htm
*/
public class SalesforceOAuthFlow extends BaseOAuthFlow {

Expand Down Expand Up @@ -50,7 +51,7 @@ protected String formatConsentUrl(UUID definitionId, String clientId, String red
}

@Override
protected String getAccessTokenUrl() {
protected String getAccessTokenUrl(JsonNode oAuthConfig) {
return ACCESS_TOKEN_URL;
}

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

@Override
protected Map<String, Object> extractRefreshToken(JsonNode data) throws IOException {
protected Map<String, Object> extractRefreshToken(JsonNode data, String accessTokenUrl) throws IOException {
System.out.println(Jsons.serialize(data));
if (data.has("refresh_token")) {
final String refreshToken = data.get("refresh_token").asText();
return Map.of("refresh_token", refreshToken);
} else {
throw new IOException(String.format("Missing 'refresh_token' in query params from %s", ACCESS_TOKEN_URL));
throw new IOException(String.format("Missing 'refresh_token' in query params from %s", accessTokenUrl));
}
}

Expand Down