Creating the Code to Login with Google
Let's add in the login form the Button that you can create with the Code Generator
<fieldset>
<div id="g_id_onload"
data-client_id="YOUR ID HERE"
data-context="signin"
data-ux_mode="popup"
data-callback="loginFromGoogle"
data-auto_select="false"
data-itp_support="false">
</div>
<div class="g_id_signin"
data-type="standard"
data-shape="rectangular"
data-theme="outline"
data-text="signin_with"
data-size="medium"
data-logo_alignment="left">
</div>
Also, in Auth.js
we have to add the following call:
loginFromGoogle: async (data) => {
const response = await API.loginFromGoogle(data)
Auth.postLogin(response, {
name: response.name,
email: response.email
});
},