I’m using REST API
And looking for the simple authorization way
namespace :token do
desc 'generate access token'
task :generate_access_token do
require 'faraday'
require 'uri'
data = {
application: ENV['INFUSIONSOFT_API_URL'],
scope: 'full',
client_id: ENV['INFUSIONSOFT_CLIENT_ID'],
client_secret: ENV['INFUSIONSOFT_CLIENT_SECRET'],
}
authorization_string = "#{ENV['INFUSIONSOFT_CLIENT_ID']}:#{ENV['INFUSIONSOFT_CLIENT_SECRET']}"
url = "https://accounts.infusionsoft.com/app/oauth/userToken"
response = Faraday.post(url) do |req|
req.headers['Authorization'] = "Basic #{Base64.strict_encode64(authorization_string)}"
req.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
req.body = URI.encode_www_form(data)
end
response_body = JSON.parse(response.body)
...
end
end
It works in case I add Cookie to reqest Header
req.headers['Cookie'] = "SESSION=YWU3ZjExMDgtNjliNS00ZGEyLWFmMmEtMWU5ODEwODM4ODFi"
But session expiring soon and its inconvenient
Is there the simple way without Authorization to proceed REST API implementation?
My contacts shouldn’t Authorize I just need to apply the tags actions to my contacts that using my App and already Authorized there
I have found this link but its not clear Making OAuth Requests Without User Authorization - Keap Developer Portal
Please advise