2

I have project with Djang + React and I need using Google OAuth2 to authenticate user login. Looks like social-auth-app-django is popular package to use for Django, and I had a search on how to use it.

But I could not find any example with React on frontend. I can see a lot of examples with a button implemented by Djang templates like this.

 <a class="btn btn-primary" href="{% url 'social:begin' 'google-oauth2' %}">
    Login
 </a>

But what it should be pointing to with a React Login button? And should I pass Google OAuth2 Key or Google OAuth2 Secret from React to Django?

NEED HELP, thanks!

Keannylen
  • 453
  • 1
  • 4
  • 17
  • Per [this](https://stackoverflow.com/a/46476631/399435) answer: _While using `Login` for login, it translates to `/login/google-plus/`. This not only get's the acess_token but also creates a "social user" in your database._ May be that will point you in the right direction. – Karthic Raghupathi Sep 24 '20 at 03:43

1 Answers1

0

If you want to use Google OAuth2 in react, react-google-login is a good package.

Muhammad Haseeb
  • 1,269
  • 12
  • 22