CodetrixStudio / CapacitorGoogleAuth

Capacitor plugin for Google Auth. Lightweight & no dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CORS policies blocked the Android Google Authentication

achraf-io opened this issue · comments

Hello, hope you all doing good.
I m using the Plugin in my MERN app, I generate the mobile app using capacitor 4, everything works fine !
In my google auth process, I have followed the documentation, and I updated my MainActivity like this :

    // Initializes the Capacitor GoogleAuth plugin
    registerPlugin(GoogleAuth.class);

    // Initialize the Facebook SDK
    FacebookSdk.sdkInitialize(getApplicationContext());

    AppEventsLogger.activateApp(getApplication(), "**********");

In android Studio, I get the window in order to auth with google, but when I click on continue it throw me this error :
E/Capacitor/Console: File: http://localhost/#/auth/sign-in/default - Line 0 - Msg: Access to XMLHttpRequest at 'https://jumatik.ma/#/auth/sign-in' (redirected from 'https://jumatik.ma:6001/auth/oauth/google/callback') from origin 'null' 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.
I don't know what is really triggering this, but it something related to CORS policies.
Thanks for you efforts.

image
image