Social authentication React Native + Django allauth

I'm building a React Native mobile app with a Django backend. I want to use the django-allauth headless mode for authentication.

I’ve seen the official example for the React SPA, but that example uses a proxy (Traefik) to keep the frontend and backend on the same origin. Since I'm developing a mobile app, I'm dealing with a cross-origin setup where the app and API live on different domains. In this case, I don't know how to resolve this.

How should I configure the HEADLESS_FRONTEND_URLS setting to allow Google authentication from my React Native app? Should the OAuth token that i create in the Google cloud console be "Web application" or "Android/iOS"?

Up until now, I've got allauth working with regular authentication and can request the providers, etc.

Unlike Web, React Native has no concept like browser based cookies, sessions,....

Most Authentication strategy work within browser not work. It rely on Fetch API to make requests on server and you should optimize your backend for it.

Third-party provided authentication services like Login With Google or Apple Sign-in has their native implementation to respect as required by each mobile platform vendors (Apple & Google).

You have to think authentication in OAuth2 context than specific Django implementation.

Вернуться на верх