This is an unofficial OmniAuth strategy for authenticating to SageOne. To use it, you'll need to sign up for a Sage One OAuth2 Application ID and Secret.
use OmniAuth::Builder do
provider :sageone, ENV['SAGE_CLIENT_ID'], ENV['SAGE_CLIENT_SECRET'], scope: 'full_access'
end
# Options for `scope` are either `readonly` or `full_access`.
The hash in env['omniauth.auth']
will have the following information:
- in
credentials
:token
: The access token.refresh_token
: The refresh token. Use this to get a new token when the one intoken
has been expired.expires_at
: Timestamp that indicates whentoken
will expire.expires
:true
resource_owner_id
: An ID returned by Sage One when fetching the access token. You'll need that value for API v3 for request signing and theX-SITE
header that is required on API requests.
- in
info
:country
: The user's country.
- in
uid
: Therequested_by_id
returned by Sage One when fetching the token.
https://developer.sageone.com has the Sage One API documentation.