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
Salesforce Marketing Cloud strategy and dynamically setting the client_options.token_url
?
#1054
Comments
@popcorn Hi! Did you get any further with your SFMC omniauth provider? :) |
Hey, we put the SFMC integration on the backburner for now. You? |
@popcorn Ended up writing small subclass to https://github.com/omniauth/omniauth-oauth2, putting it in my local lib folder and using that. That part was pretty straight forward. Regarding what you asked below, you have to use the https://github.com/omniauth/omniauth/wiki/Dynamic-Providers approach. I had a similar, but not exact same, situation. Users enter their subdomain, client_id and client_secret in my app and I have to redirect to the correct domains etc. Ended up with something along the lines of: provider :salesforce_marketing_cloud,
setup: lambda { |env|
request = ActionDispatch::Request.new(env)
integration_id = env['rack.session'][:auth_integration_id]
integration = Integration.find(integration_id)
if integration.is_a? SalesforceMarketingCloudIntegrationV2
env['omniauth.strategy'].options.merge!(
{
client_id: integration.settings['client_id'],
client_secret: integration.settings['client_secret'],
scope: 'saved_content_read saved_content_write documents_and_images_read documents_and_images_write email_read email_write offline',
client_options: {
authorize_url: "https://#{integration.settings['subdomain']}.auth.marketingcloudapis.com/v2/authorize",
token_url: "https://#{integration.settings['subdomain']}.auth.marketingcloudapis.com/v2/token",
site: "https://#{integration.settings['subdomain']}.auth.marketingcloudapis.com"
}
}
)
end
} Hope it can be of some use! |
That's great! I may ask you a few more questions about it when we continue working on the SFMC integration again. Feels less lonely now knowing someone else went through same struggles with SFMC 😄 |
Hi there, as the subject says, is there a way to dynamically set the URL on which we request tokens?
Why?
I'm creating an OAuth integration for Salesforce Marketing Cloud (SFMC).
Every customer on SFMC gets their own domain that has to be used for API calls, and for requesting tokens. This domain is returned alongside code and state parameters when the customer authorizes my app.
From SFMC docs:
Is there a way to take the
tssd
parameter (customer subdomain) from the authorization response and use it as an URL on which I request the tokens?The text was updated successfully, but these errors were encountered: