Skip to main content
edited title
Link
identigral
  • 7.8k
  • 34
  • 33
  • 45

Trying Connecting to connect/auth for first timeMarketing Cloud from R

edited tags
Link
Lukas Lunow
  • 22.2k
  • 4
  • 27
  • 59
Source Link

Trying to connect/auth for first time

(Tag suggestions very welcome, this is my first post on this forum)

We use ExactTarget to manage our customers email. I would like to do some reporting and analytics using these data - email subject line, sends, opens etc.

R's Salesforcer package provides an interface for R to connect to Salesforce via API. With this post, my goal is to get help or pointers to just get my connection/auth done. I am unsure what I need to set up in the Exact Target UI first, if anything (Packages?)

I followed the auth guide here.

library(dplyr)
library(salesforcer)

# Using OAuth 2.0 authentication
sf_auth()

When the browser tab opens to login, I enter my login details at the page https://login.salesforce.com. But my login credentials don't work here. I would usually login at mc.login.exacttarget.com.

I tried changing the login url field sf_auth(login_url = 'https://mc.login.exacttarget.com') which resulted in a new browser tab with a forbidden message:

Forbidden
You don't have permission to access /services/oauth2/authorize on this server.

When I login via browser outside of the R package, I am able to navigate to set up > platform tools > apps > installed packages. Here I can create new apps and give them permissions. There's various options such as server to server, web, and then the permissions granted to the app. Once saved I'm provided with various API integration components including:

client id
client secret
Authentication, REST and SOAP Base URIs

I tried changing options to use these credentials e.g. from this page.

options(salesforcer.consumer_key = "<my client id>")
options(salesforcer.consumer_secret = "<my client secret>")
sf_auth()

This opens a browser tab with message

error=invalid_client_id&error_description=client%20identifier%20invalid

I tried including the loginurl again but got the same forbidden error message.

How can I connect to SalesForce to extract ExactTarget email data using R? Do I need to create a package within Salesforce UI or should I be able to login just with my browser login credentials?