Added instance_url and refresh_token to credentials hash. #1

Merged
merged 1 commit into from Nov 18, 2011

Projects

None yet

2 participants

@localredhead

salesforce does not have an expiration date on the refresh token - so OmniAuth gem does not set that property from the auth hash.

Thanks you for this strategy. We're using it just fine now but It wouldn't work without the instance_url in the credentials hash because the default OAuth2 strategy supplied in the OmniAuth 1.0 gem only sets the following:

credentials do
    hash = {'token' => access_token.token}
    hash.merge!('refresh_token' => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
    hash.merge!('expires_at' => access_token.expires_at) if access_token.expires?
    hash.merge!('expires' => access_token.expires?)
    hash
end
@localredhead localredhead Added instance_url and refresh_token to the credentials hash. Salesfo…
…rce does not have an expiration date on teh refresh token - as such the OmniAuth gem does not set that property from the auth hash.
2100e0e
@richardvanhook richardvanhook merged commit 3c6995d into richardvanhook:master Nov 18, 2011
@richardvanhook
Owner

Thanks Levi! I merged your request but I don't have time at the moment to
upload changes to the gem. Will do that early next week, please remind me
if you don't hear from me.

Any other suggested changes?

-Richard

On Thu, Nov 17, 2011 at 8:00 PM, Levi Strope <
reply@reply.github.com

wrote:

salesforce does not have an expiration date on the refresh token - so
OmniAuth gem does not set that property from the auth hash.

Thanks you for this strategy. We're using it just fine now but It
wouldn't work without the instance_url in the credentials hash because the
default OAuth2 strategy supplied in the OmniAuth 1.0 gem only sets the
following:

credentials do
hash = {'token' => access_token.token}
hash.merge!('refresh_token' => access_token.refresh_token) if
access_token.expires? && access_token.refresh_token
hash.merge!('expires_at' => access_token.expires_at) if
access_token.expires?
hash.merge!('expires' => access_token.expires?)
hash
end

You can merge this Pull Request by running:

git pull https://github.com/localredhead/omniauth-salesforce master

Or you can view, comment on it, or merge it online at:

#1

-- Commit Summary --

  • Added instance_url and refresh_token to the credentials hash.
    Salesforce does not have an expiration date on teh refresh token - as such
    the OmniAuth gem does not set that property from the auth hash.

-- File Changes --

M lib/omniauth/strategies/salesforce.rb (7)

-- Patch Links --

https://github.com/richardvanhook/omniauth-salesforce/pull/1.patch
https://github.com/richardvanhook/omniauth-salesforce/pull/1.diff


Reply to this email directly or view it on GitHub:
#1

@localredhead

Hello Richard - I have no other suggestions for it.

I just implemented the Refresh token flow on our end using this gem with my minor additions and it is working smoothly.

It's a shame they haven't listed this on the OmniAuth 1.0 wiki yet - I saw your message in the group noting that you'd like it added. Perhaps we can throw some specs in there so that people will feel more comfortable blessing it?

Regards,
Levi

@richardvanhook
Owner

Hi Levi, I just added ur updates from this issue to gem via version 1.0.2. Please verify for me, thanks!

-Richard

@localredhead

it works! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment