Am trying to access data from Exact Online API Using Faraday Gem and it is returning the status of "401"
meaning am not authorized to access that link before I login, but I had already been authenticated and I logged in successfully in a different page.
If I try to access that link individually via the browser URL bar I can see the data.
Here is my controller
def example1
@exact_conn = Faraday.new(:url => 'https://start.exactonline.nl') do |data|
data.request :url_encoded
data.response :logger
data.adapter Faraday.default_adapter
end
data = @exact_conn.get("/api/v1/{division}/salesinvoice/SalesInvoices"
@received_data = data.status
end
my View
<h1>Received Data</h1>
<%= @received_data %>
How can i solve this issue?
Or
Is their any other option I can use in order to access that data directly without being authenticated for second time?.