-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Oauth related example #123
Comments
Also I couldnt find cache file .httr-oauth-salesforcer generated in current working directory.. Is it fine to generate file and update as per some template? If so will behelpful if you can share sample.. |
@ghareesh It sounds like you switched platforms and re-installed the {salesforcer} package, which installed the latest version (v1.0.1) that is different from what you were using in your prod environment. Option 1The easiest option, if you're happy using v0.1.3.9000, is to install a similar version from the CRAN archives or from a specific commit in the GitHub repo. Example installing from CRAN archives packageurl <- "https://cran.r-project.org/src/contrib/Archive/salesforcer/salesforcer_0.1.4.tar.gz"
install.packages(packageurl, repos=NULL, type="source") Option 2Instead of authenticating with an OAuth2.0 token, continue to authenticate using a username and password. Option 3We could try and troubleshoot how your connected app is setup. It looks like your error relates to the callback URL. The default is |
Hi Steve, as discussed over chat.. On Oauth issue, I will try configuring callback url and update you. Error I am getting there is Call back url provided on app was - https://vmware--sdpqa.my.salesforce.com/services/oauth2/callback |
Hi Steve I'm Facing a similar issue as @ghareesh. The authentication works fine while running it in Rstudio on local machine. If I try to run the authentication from the Rstudio server, the callback URL defaults to In {gargle}, the suggested way is to set Thank you in advance |
@ViswaDutt-P One option is to copy your local cached token file (named |
@ghareesh Your query looks like a fairly complex relationship query. Back in July 2020, as part of v0.2.0, I updated the way In the short term, I'd recommending sticking with an older version of the package (maybe v.01.5?). In the long term, I'm happy to help troubleshoot this specific case. For example, take a look at the code that's behind sf_query() and run it step-by-step. Take the output of the httr_response object on Line 183, save it as an .rds object with saveRDS(), and email it to me for further debugging on how to parse the JSON or XML (depending on whether you use the REST or SOAP API). Or you are welcome to work on the parsing of the API response object if the data could be sensitive and you can't share. The only way to know why the subscript error is occurring would be to look at how the response is being parsed. |
@StevenMMortimer |
@StevenMMortimer Thank you for the suggestion. I've tried it and works like a charm. just curious to know, is there any other option as well ? |
@viswaduttp The other option, instead of relying on the cached token, is saving the token itself and loading it like this to authenticate: # Save token to disk and log in using it
saveRDS(salesforcer_state()$token, "token.rds")
sf_auth(token = "token.rds") You also might be able to log in with just a username, password, and security token if your org doesn't require programmatic access (API access) to use multi-factor authentication. If you're not familiar with security tokens, there are a bunch of articles you can Google. Here is one that does a decent job at showing how to find yours: https://www.mcafee.com/blogs/enterprise/cloud-security/what-is-salesforce-security-token-and-how-do-i-find-it/ |
@ghareesh Apologies, if you're having trouble with installing from the archives. It looks like the only versions in the archive prior to v0.2.0 are v0.1.2, v0.1.3, and v.0.1.4 so you're welcome to try any of those. A better alternative, might be trying to install the exact version of what's on your prod server. To do this I'd recommend running After finding the salesforcer commit that you've installed, then you can simply re-install from that specific commit again using this command: # install.packages("remotes")
remotes::install_github("StevenMMortimer/salesforcer", ref="COMMIT HASH HERE") |
@StevenMMortimer I tried with 0.1.4 since it was only version available next to what I had in server (0.1.3.9000).. Even it was not working.. So I just copied 0.1.3.9000 version from lib file of server and put it on to my new platform.. It seems to be working fine.. But my worry is in case it becomes non compatible with latest R versions in future.. will have to start from scratch again for resolving issue.. |
@ghareesh Copying the lib folder works too! This gives me the idea that I should add a function argument that will allow users to export the raw JSON or XML when running Keep me posted if you run into more issues. |
@StevenMMortimer Sharing is not an issue.. Given my non coding background, I find it hard to understand function .. Below lines what should be filling values? query_url <- make_query_url(soql, queryall, next_records_url).. May be getting into call can fix this sooner.. Thoughts? |
@ghareesh |
Hi Steve..
I am using salesforcer package 0.1.3.9000 in my prod server.. recently I migrated code to new platform.. But somehow this version is not available to pull from.. I used latest version by default.. but I am not able to fetch data using same..
mostly related to sf_auth.. Could you share example of how to change from simple user login to oauth based?
I am doing like this.. Please correct
options(salesforcer.consumer_key = "consumer-key")
options(salesforcer.consumer_secret = "consumer-secret")
sf_auth(login_url = "https://vmware--sdpqa.cs24.my.salesforce.com/")
Once logged in, I clicked on allow access.
After that I get below screen
Please help me understand how to proceed with API connectivity using oauth.. I am in catch20 here.. :(
The text was updated successfully, but these errors were encountered: