Get user's information from Google Sign Up using Django?
Question:
I have added the "Continue with Google" button in my HTML code and all of that works and after the user has gone through that process it sends a POST request to my backend with the variables "credential" and "g_csrf_token".
I want to know how to handle this information and get the user’s name, email, profile picture, etc.
This is the HTML code that sends the request:
<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="g_id_onload"
data-client_id="188921335755-m1v9q2v7lghon45rlp89qq2rm7f4ko9c.apps.googleusercontent.com"
data-login_uri="http://localhost:8000/accounts/signup/continue-with-google/"
data-auto_prompt="false">
</div>
<div id="continueWithGoogleButton" class="g_id_signin"
data-type="standard"
data-size="large"
data-theme="outline"
data-text="continue_with"
data-shape="pill"
data-logo_alignment="left"
data-width="300">
</div>
Answers:
This is the documentation:
https://developers.google.com/identity/gsi/web
Explore here and follow instructions.
I know it is really simple, don’t worry!
I have added the "Continue with Google" button in my HTML code and all of that works and after the user has gone through that process it sends a POST request to my backend with the variables "credential" and "g_csrf_token".
I want to know how to handle this information and get the user’s name, email, profile picture, etc.
This is the HTML code that sends the request:
<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="g_id_onload"
data-client_id="188921335755-m1v9q2v7lghon45rlp89qq2rm7f4ko9c.apps.googleusercontent.com"
data-login_uri="http://localhost:8000/accounts/signup/continue-with-google/"
data-auto_prompt="false">
</div>
<div id="continueWithGoogleButton" class="g_id_signin"
data-type="standard"
data-size="large"
data-theme="outline"
data-text="continue_with"
data-shape="pill"
data-logo_alignment="left"
data-width="300">
</div>
This is the documentation:
https://developers.google.com/identity/gsi/web
Explore here and follow instructions.
I know it is really simple, don’t worry!