Skip to content

Issue with Refresh Token Flow in Salesforce OAuth Integration for AWS AppFlow

0

I’m facing an issue with integrating Salesforce OAuth authentication into AWS AppFlow. Specifically, the access token issued for Salesforce is expiring, but I’m unable to successfully refresh it using the refresh_token.

Steps I’ve Taken:

1.	Salesforce Connected App Configuration:
            I’ve created a Connected App in Salesforce with the following OAuth settings:
        Scopes: Perform requests on your behalf at any time (refresh_token, offline_access)
        Callback URL: Configured as required by AWS AppFlow
        OAuth Flow: Authorization Code Flow
        Refresh Token: Enabled, and scope configured correctly
2.	AppFlow Configuration:
        Using appflow_client.create_connector_profile() to create the Salesforce connector profile.
        Set up OAuth 2.0 authentication using the client ID, client secret, and the authorization code received.
        The initial access token is generated successfully, but when it expires, the refresh token flow does not seem to work as expected.

The Issue: • After the access token expires, the refresh token isn’t used to obtain a new access token, even though the refresh token is valid.

What I’ve Tried: • Double-checked the refresh_token scope in the Salesforce Connected App and confirmed it is enabled. • Ensured the client secret is included in the refresh_token flow. • Tried re-authorizing the Salesforce Connected App to ensure the refresh_token was generated correctly.

1.	Is there any additional configuration needed in the Salesforce Connected App to ensure the refresh token flow works properly with AWS AppFlow?
2.	Does AWS AppFlow handle refresh token management automatically, or do I need to implement it manually?

Environment:

•	Salesforce Connected App: OAuth 2.0, Authorization Code Flow
•	AWS AppFlow: Using the Salesforce connector
•	API Integration using Python and AppFlow SDK

asked 2 years ago954 views

1 Answer
0

Thank you for providing detailed information about your issue with the Salesforce OAuth integration in AWS AppFlow. Let me address your questions and provide some insights based on the information available.

  1. Regarding additional configuration in the Salesforce Connected App: Based on the steps you've taken, it appears that you have correctly configured the Salesforce Connected App for OAuth 2.0 with the Authorization Code Flow. You've included the necessary scopes, including "refresh_token" and "offline_access", which are crucial for the refresh token flow. The callback URL is also set up as required by AWS AppFlow. Given this information, there doesn't seem to be any additional configuration needed on the Salesforce side to ensure the refresh token flow works properly.

  2. AWS AppFlow's handling of refresh token management: AWS AppFlow is designed to handle refresh token management automatically. When you create a connector profile using the Authorization Code Flow, AppFlow should manage the token lifecycle, including refreshing the access token when it expires. This process should happen behind the scenes without requiring manual intervention.

However, given that you're experiencing issues with the refresh token flow, here are a few things to consider:

  • Ensure that the token URL in your AppFlow configuration is correct. It should be in the format: https://[your_salesforce_instance]/services/oauth2/token.

  • Verify that the client ID and client secret used in your AppFlow configuration match exactly with those provided by your Salesforce Connected App.

  • Check if there are any permission issues or IP restrictions set in your Salesforce org that might be preventing the refresh token from being used.

  • Review your AppFlow connector profile configuration to ensure all OAuth-related fields are correctly populated, including the token URL and any required scopes.

If you've verified all these points and are still experiencing issues, it may be worth reaching out to AWS support for further assistance. They can provide more specific guidance based on your account and configuration details.

Remember that while AppFlow should handle token refresh automatically, the initial setup and configuration of the OAuth flow is crucial for its proper functioning. Double-check all the parameters in your create_connector_profile() call to ensure they align with the Salesforce Connected App settings.

Sources
Connect to Salesforce - AWS App Studio
OAuthProperties - AmazonAppFlow
Token - AWS AppFabric

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.