i was wondering how to specify the redirect url for a google sign-in button, here is the button:
I believe Google changed this a while ago.
What I used to redirect:
gapi.load('auth2', () => {
auth2 = gapi.auth2.init({
client_id: '615643915869-vufkml5ogm4j4a01qbshk9darkhq7vpr.apps.googleusercontent.com',
fetch_basic_profile: true,
ux_mode: redirect,
redirect_uri: ''
});
auth2.signIn().then(() => {
var profile = auth2.currentUser.get().getBasicProfile();
console.log('Image URL: ' + profile.getImageUrl());
console.log('ID: ' + profile.getId());
console.log('Full Name: ' + profile.getName());
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
console.log('Email: ' + profile.getEmail());
}).catch((error) => {
console.error('Google Sign Up or Login Error: ', error)
});
});
The parameter ux_mode can be either 'popup' or 'redirect'.
If the latter is chosen the parameter redirect_uri can take your url
If using ux_mode='redirect', this parameter allows you to override the default redirect_uri that will be used at the end of the consent flow. The default redirect_uri is the current URL stripped of query parameters and hash fragment.
Here is Link to the Documentation