Hello, I hope you can guide me in the right direction here since I've been pretty stuck. I am making a request from my react from end to my nodejs api and I am getting the following error. Any idea what's happening? Thanks!
Access to fetch at 'https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=22C384&scope=activity%20heartra...' (redirected from 'http://localhost:5000/api/fitbit/authorize') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Hi @alvarodltlp,
Welcome to the forums!
Are you attempting to authorize other users other than yourself? Or are you using this authorization URL for yourself for testing purposes? The reason I ask is the redirect URI you're using is fine for testing purposes, but wont work in a production environment. Localhost is not a URL that is external to the internet world that the public can access. You'll need to provide a valid redirect URI to your application to redirect your users back to after they grant consent to your application.
I hope this helps. Let me know if you continue to encounter this error after changing your redirect URI.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
@sajid Welcome to the forums!
Are you using localhost as your redirect url as well? Or are you using your IP address?
Best Answer