Ruby OAuth with Salesforce not getting refresh_token -
i can't seem refresh_token whenever i'm authorized, i've tried setting headers, kind of how done google oauth, not luck. here's process:
using oauth2
gem
instantiate client
client = oauth2::client.new( salesforce_app_key, salesforce_secret_key, site: 'https://login.salesforce.com/services/oauth2/', authorize_url: 'https://login.salesforce.com/services/oauth2/authorize', token_url: 'https://login.salesforce.com/services/oauth2/token', raise_errors: false )
authorize connection
auth = client.auth_code.authorize_url( redirect_uri: 'https://my_app_callback.com/oauth/authorize' )
fetch token
token = client.auth_code.get_token( code, redirect_uri: 'https://my_app_callback.com/oauth/authorize' )
from point, have connection set, when token.refresh_token
nil value.
by using:
access_token = oauth2::accesstoken.new(oauth, token)
the session reestablished successfully. it's in docs, not written in way uderstand it's used reauthenticate.
Comments
Post a Comment