CORS in Ionic and third party api(Smartsheet)
I am trying to get data from smartsheet API. When I use postman and nodejs in separate server code, it works.
But if I use the API inside the Ionic with HttpClient (@angular/http) it gives CORS issue with run in browser.
Failed to load https://api.smartsheet.com/2.0/sheets/1235941564208899972: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
Comments
-
Hi Gopala,
That looks like an issue with your API key not working in Iconic (or possibly HTTPClient, not sure where the issue would be).
The OAuth flow header isn't being included in your response, so it considers your call out of scope. Details on OAuth flow and access scopes can be found here: https://smartsheet-platform.github.io/api-docs/#overview
I'd recommend reviewing the API key you're using, make sure it's carrying over correctly, and possibly generate a different API key from your account to troubleshoot. You can generate API keys with the following steps:
- Sign in to your Smartsheet account on a browser.
- Click your profile icon and select Apps & Integration > API Access.
- Click the Generate new access token button and give your new token a name so you know what it's being used for.
- Copy and paste that new token into your API access header.
If you continue to experience issues, please reach out to our Support team to troubleshoot further.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 460 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 461 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives