rising-crimson
rising-crimson10mo ago

Google OAuth Not Working

Hi all, I have initialised a refine project using React + Vite config, and selected Google OAuth as Auth provider, I have created a Google Client ID and replaced it in the project. But for some reason it is not working. I reffered the official docs for Google OAuth and got a Codesandbox link, there too the authentication is not working. Did someone faced this issue before? What should I put for Authorised JavaScript origins and Authorized redirected URI in the Google Cloud Console. I have entered http://localhost:5173 for both.
4 Replies
kapa.ai
kapa.ai10mo ago
Hi @shivraj4155. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The issue you're facing might be due to incorrect configuration of the Authorized JavaScript origins and Authorized redirect URIs in the Google Cloud Console. For the "Authorised JavaScript origins", you should add your app origin. Since you are working in the development environment, you should copy/paste your app URL which is running on localhost. For the "Authorised redirect URIs", you must include your full domain and end in the callback path. The URIs should be as follows: - For production: <https://{YOUR_DOMAIN}/api/auth/callback/google> - For development: <http://localhost:3000/api/auth/callback/google> Please note that if you eventually push to production, you need to change the Authorised JavaScript Origin and Authorised redirect URIs to the production URIs. You can refer to the official documentation (https://refine.dev/docs/examples/auth-provider/google-auth/) for more details. If you're still facing issues, it might be helpful to check the error messages you're receiving and ensure that your Google Client ID is correctly configured in your project. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@530658917106057226> kapa.ai is still learning and improving, please let us know how it did by reacting below
genetic-orange
genetic-orange10mo ago
Hey @shivraj4155, You can follow this: https://discord.com/channels/837692625737613362/1074755669099548722/1074755669099548722 I hope it helps 🙏
rising-crimson
rising-crimson10mo ago
Hi @salihozdemir I think there is some problem with the Refine + Vite setup, It worked with React + CRA, I didn't change anything in Google Cloud Console except the port. I changed it from 5173 to 3000. and it worked!