Open Saqib92 opened 6 days ago
Google Login not working in browser. it open google login window and after authorizing it closes but data is not returning.
Same issue with me :(
There is an open PR addressing this issue: #37
Not working on web. Throwing this error on web. Before that at least Google Auth window were opening.
This does not look like a problem with the plugin. The stacktrace does not mention CapacitorSociaLogin once
Not working on web. Throwing this error on web. Before that at least Google Auth window were opening.
Hey @Saqib92 this is my mail @hamza.ahtsham1@gmail.com
can you send me the sample code
Not working on web. Throwing this error on web. Before that at least Google Auth window were opening.
Hey @Saqib92 this is my mail @hamza.ahtsham1@gmail.com
can you send me the sample code
what issue are you facing. your image is broken.
This does not look like a problem with the plugin. The stacktrace does not mention CapacitorSociaLogin once
my implementation:
async googleLogin() {
let options: InitializeOptions = {};
if (Capacitor.getPlatform() == 'ios') {
options = {
google: {
iOSClientId: environment.google.iOSClientId, // the iOS client id
iOSServerClientId: environment.google.iOSServerClientId // the iOS server client id (optional)
},
}
} else {
console.log('here')
options = {
google: {
webClientId: environment.google.webClientId // the web client id for Android and Web
}
}
}
await SocialLogin.initialize(options);
const res = await SocialLogin.login({
provider: 'google',
options: {
scopes: ['email', 'profile'],
},
});
console.log(res);
}
Same here, no response after login at all. I'm trying google login
I'm looking with @Saqib92 to find a fix
Demo Repo to reproduce issue: https://github.com/Saqib92/Saqib92-camera-preview-uploader-issue
@Saqib92 you want to remove scopes
when calling login
Right now, you are doing
const res = await SocialLogin.login({
provider: 'google',
options: {
scopes: ['email', 'profile'], // <--- this is bad
},
});
I did not implement scopes yet. It's something that could be implemented in the near future, but for the time being if you set scopes
the code will reject your login
The correct way would be:
const res = await SocialLogin.login({
provider: 'google',
options: {},
});
This works better, but you get this error
Please make sure you don't have any redirect URLs added in the Google Console. This is clearly mentioned in the documentation
The correct way would be:
const res = await SocialLogin.login({ provider: 'google', options: {}, });
This works better, but you get this error
Please make sure you don't have any redirect URLs added in the Google Console. This is clearly mentioned in the documentation
Thank you, But i do require scopes as my app targets some sensitive scopes, like spreadsheet read and write permission via serverAuthCode and refresh token.
I could implement additional scopes, but first please make sure that your app works with the current version of the plugin.
Please let me know if removing scopes fixed your problem
I could implement additional scopes, but first please make sure that your app works with the current version of the plugin.
Please let me know if removing scopes fixed your problem
Yes, i can confirm it is working on Web WITHOUT scopes.
Hey @Saqib92 can i get your linkedin by any chance
Hi,
I just build my app for production and tried google login on android device. After click on google login button the alert to select account is presented. After selecting account alert is closed but I have an error in sentry Google Sign-In failed: activity is cancelled by the user.
. Could plese help?
EDIT: On debug version, it works like a charm.
Thanks
What version are you on, and have you followed the setup guide?
Sure, by the setup guide I have this function:
let options: InitializeOptions = {};
if (Capacitor.getPlatform() === 'ios') {
options = {
google: {
iOSClientId: environment.googleIosClientId
},
}
} else {
options = {
google: {
webClientId: environment.googleWebClientId
}
}
}
await SocialLogin.initialize(options);
await this.loadingHelper.presentLoader(null, null, 'googleLoginApi()');
try {
const googleInit = await SocialLogin.initialize(options);
Sentry.captureMessage('GOOGLE init resp: ' + JSON.stringify(googleInit));
await this.loadingHelper.presentLoader(null, null, 'googleLoginApi()');
const res = await SocialLogin.login({
provider: 'google',
options: {
scopes: ['email', 'profile'],
},
});
Sentry.captureMessage('GOOGLE login resp: ' + JSON.stringify(res));
if (res && res.result.accessToken.token) {
const profile = {
token: res.result.accessToken.token,
email: res.result.profile.email,
// @ts-ignore
fullName: res.result.profile.name
};
return profile;
}
} catch (e) {
console.warn("GOOGLE LOGIN ERROR", e)
Sentry.captureException('Error logging into GOOGLE: ' + JSON.stringify(e));
}
}
Version of @capgo/capacitor-social-login
is 0.0.67
.
Other versions:
Ionic:
Ionic CLI : 6.20.9 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : not installed
@angular-devkit/build-angular : 18.2.11
@angular-devkit/schematics : 18.2.11
@angular/cli : 18.2.11
@ionic/angular-toolkit : 11.0.1
Capacitor:
Capacitor CLI : 6.1.2
@capacitor/android : 6.1.2
@capacitor/core : 6.1.2
@capacitor/ios : 6.1.2
Utility:
cordova-res : not installed globally
native-run : 2.0.1
System:
NodeJS : v20.14.0 (/Users/mc/.nvm/versions/node/v20.14.0/bin/node)
npm : 10.7.0
OS : macOS Unknown
Hey @Saqib92 can i get your linkedin by any chance
Please Email me at: najamsaqib0880@gmail.com
Can you try the "0.0.68-alpha.2" and follow the guide?
Google Login not working in browser. it open google login window and after authorizing it closes but data is not returning.