REST API: Error --> "Access-Control-Allow-Origin"

Hi Team,

I would like to call REST API Authentication step through UI(AngularJS) and getting following error message. Can you please help me how to make Dremio REST API calls via UI ?

Error Message:
login.html:1 Failed to load http://server/apiv2/login: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.

I would really appreciate your help.

Thanks,
Chiranjeevi

Hi @ChiranjeeviKolli

What are you trying to do through REST API like “refresh metadata”?

Just to be sure you would have replace things like “server” with your server name in case you did not

Thanks
@balaji.ramaswamy

Hi Balaji,

Yes, I have already taken care of server name in my earlier post. Due to security reasons, I have not posted the full server name.

I would like to make a REST API call for getting authentication token, submitting SQL, and getting results of posted SQL through UI(AngularJS).

While running the AngularJS code for getting the Authentication token I was getting following error message.

“Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource”

Thanks,
Chiranjeevi

Hi Team,

Any luck on my request ? I would really appreciate your prompt response.

Thanks,
Chiranjeevi

If you are trying to directly connect to the Dremio APIs from a browser, that is currently not supported. You could try an external server?

Hi Anthony,

Could you please expand your external server approach ?

It would be really helpful if you provide detailed steps.

Thanks,
Chiranjeevi

Hi Anthony,

Can you please elaborate your external server approach?

Thanks,
Chiranjeevi

Sorry - I meant to try to call Dremio API from another server other than what your AngularJS is currently hosted on.

A quick Google search shows this is a common error, maybe it can provide some more alternatives?