Skip to content

Conversation

@dchaley
Copy link

@dchaley dchaley commented Oct 6, 2014

When the info request is a post, I consistently get this error:
(salesforce) Authentication failure! invalid_credentials: OAuth2::Error, Missing_OAuth_Token

This is despite the post having an oauth token parameter:

post https://login.salesforce.com/id/obfuscated/obfuscated?oauth_token=obfuscated

It seems that this request doesn't have to be a post in the first place, and changing it to a get consistently makes the request succeed. I confess to not having tracked down why, exactly, the change works.

This is using faraday (0.9.0). Perhaps it is a faraday compatibility issue with how the post request is constructed. This working sample:
https://github.com/takahiro-yonei/OmniAuth-Salesforce-Sample
uses Faraday 0.7.6.

e.g., it could be an error in how the Oauth2 gem is constructing its post request, by having it be a param rather than in the request body.

Sorry to not be more helpful on that part -- but can we at least focus on why it's a post and not a get, and whether changing it to a get is acceptable? Because that will avoid this problem entirely.

This makes it work... post doesn't work. BLARGH.

Many bothans died over 3 hours to bring us this realization.
@andrew2005
Copy link
Contributor

This is a bizarre one. I've been using Faraday 0.9.0 since August and only just started getting this so not sure if it's a change in Faraday. Just checked my gemspec and non of the dependencies have changed.

@dchaley
Copy link
Author

dchaley commented Oct 10, 2014

Ah-- do you get it consistently? I read somebody saying he got it sporadically. Perhaps Salesforce have changed something on their end. I think this is the documentation for it:
https://help.salesforce.com/apex/HTViewHelpDoc?id=remoteaccess_using_openid.htm&language=en_US
but it doesn't specify which HTTP methods are acceptable.

@trungpham
Copy link

can we merge this?

@realdoug
Copy link
Owner

Looks fine to me. Will test this evening and merge. Thanks.

@subhashb
Copy link

👍 Confirming that we faced the same issue in our dev boxes, and @dchaley's fix solved the problem.

@lievcin
Copy link

lievcin commented Oct 18, 2014

@dchaley @subhashb I'm getting the same issue here. Do i just need to update my gems? Can't quite pinpoint where the problem is since everything was working well until the last 24 hours.

Appreciate any help

@lievcin
Copy link

lievcin commented Oct 18, 2014

forked @dchaley 's version and it works now!!!!

@ghempton
Copy link

👍 please merge and cut a gem!

@subhashb
Copy link

👍 for merging and releasing it soon

@vijedi
Copy link

vijedi commented Oct 20, 2014

Ran into this issue as well when the application suddenly stopped authenticating. Using @dchaley fix to solve the problem.

@pulgaroja
Copy link

Please merge and release soon 👍 Thank you! We really need this for our app to work and want to be able to set our get to just pull from: gem 'omniauth-salesforce' without specifying it to pull from docsend fork. Again thanks so much!

mintotsai added a commit to mintotsai/omniauth-salesforce that referenced this pull request Oct 20, 2014
@mattmanning
Copy link

👍 Please merge

@sb8244
Copy link
Contributor

sb8244 commented Oct 22, 2014

Please don't do this. Salesforce officially supports passing the auth token in the headers and not in the body. It should support both, but they have a bug in their latest release.

This PR fixes it in a more supported way. Officially supporting what Salesforce recommends is the way to go #13

@dchaley
Copy link
Author

dchaley commented Oct 22, 2014

👍 for @sb8244's fix.

@realdoug
Copy link
Owner

Getting to this soon! Apologies for the delay!

@realdoug
Copy link
Owner

Just merged the fix #15 from @sb8244 to master. Sounds like the issue happens intermittently and I haven't been able to produce it. The current version also works fine for me so if someone who was seeing the issue could confirm that the current master branch solves this then i'll push out a new version to rubygmes later today.

Sorry again for the delay.

@sb8244
Copy link
Contributor

sb8244 commented Oct 22, 2014

Just a heads up, this happens when the access_token contains a . character in it. I am almost certain that it is an encoding issue either across HTTP or on SFDC side. So the chance that the access token contains . is pretty high, but not always the case.

@andrew2005
Copy link
Contributor

Master seems to have resolved the issue for me. I was getting it reasonably consistently across two apps.

@realdoug realdoug closed this Oct 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.