OmniAuth strategy for Acumatica OAuth2
Authorization Code Flow https://help-2020r2.acumatica.com/(W(23))/Help?ScreenId=ShowWiki&pageid=ff780860-09c2-46c9-bdd7-c6c3b1fc442c
You must first register your application with Acumatica: https://help-2020r2.acumatica.com/(W(24))/Wiki/ShowWiki.aspx?pageid=5e30ec61-7b02-495f-9e6c-1f3bfce4ad45
When you register the application, you will get an 'Client ID' and 'shared secret'. These need to be provided when you configure the strategy (this example assumes the values are available in environment variables):
Rails.application.config.middleware.use OmniAuth::Builder do
provider :acumatica, ENV['CLIENT_ID'], ENV['CLIENT_SECRET']
end
Add this line to your application's Gemfile:
gem 'omniauth-acumatica'
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-acumatica
Expected from Acumatica (as noted in their documentation at https://developers.acumatica.com/api-documentation#complete-oauth-flow):
{
"access_token":"secret_secretihaveasecret",
"token_type":"bearer",
"refresh_token":"read_store_profile update_catalog",
"expires_in":1003,
}
Strategy Output (auth_hash
):
{
"provider"=>"acumatica",
"uid"=>1003,
"info"=>{},
"credentials"=>{"token"=>"secret_secretihaveasecret", "refresh_token"=>"secret_secretihaveasecret", "token_type" => "bearer", "expires_at" => 342423423, "expires"=>true},
"extra"=>{}
}
- Fork it ( https://github.com/ShippingEasy/omniauth-acumatica/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request