EddyVerbruggen / cordova-plugin-googleplus

:heavy_plus_sign: Cordova plugin to login with Google Sign-In on iOS and Android
566 stars 626 forks source link

Login returns only user email #123

Open lessadiogo opened 9 years ago

lessadiogo commented 9 years ago

Hi, Eddy.

Congratulations for the great job. I'm in a issue, when I call the login action, success callback only retrieves me the user email, but not the others informations, like imageUrl, displayName and userId.

I don't know if it can be some problem with certificate fingerprint or other setup configuration.

Hope u have some idea about that.

Thanks, Diogo

frankps commented 9 years ago

Hey,

We have the same problem with Google login:

Does anybody have an idea (I buy you a beer when in Belgium!)?

/Frank

lessadiogo commented 9 years ago

Hi Frank,

I solved it passing the second login argument 'offline': true. (Be sure you're using quotation marks)

See details here: https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/111

Hope it helps.

danicastanos commented 9 years ago

Hi,

When I add the 'offline': true argument then I get "Failed to retrieve token: Unknown" error.

lessadiogo commented 9 years ago

@danicastanos , have u created credentials in your google developers console for the app? In plugin descriptions you can find more details.

Dineshrajaa commented 9 years ago

if I use 'offline': true I am getting "Failed to retrieve token: Unknown" error. as @danicastanos said I have configured the app in developers console

grafezia commented 9 years ago

The problem is that this plugin must show all data, but only show email???????? Can you please help ?

danicastanos commented 9 years ago

+1

vmlellis commented 9 years ago

+1

ChristopheDaVinci commented 9 years ago

If the app shows only email, that means that you deployed the app on the device from another computer than the one who created the SHA-1 key. When creating an OAuth 2.0 client ID, you must enter a SHA-1 key generated using the keytool found on your computer, if it only returns email, that means it's not your key, and you should create your own for development. It's an important point to keep in mind when publishing a release version! Try it out, it worked for me

grafezia commented 9 years ago

thank you @ChristopheDaVinci work for me :100:

Dineshrajaa commented 9 years ago

@ChristopheDaVinci then what if we build the app using build.phonegap.com what can we do for that ?

phw commented 9 years ago

then what if we build the app using build.phonegap.com what can we do for that ?

@Dineshrajaa That shouldn't make any difference. In phonegap build you also have to provide your signing key. Just create the SHA1 fingerprint for this key as described in https://developers.google.com/android/guides/client-auth

Dineshrajaa commented 9 years ago

Thank you @phw and where should I place this "google-services.json" while building the app online?

phw commented 9 years ago

@Dineshrajaa AFAIK you don't need this file. At least I never added that file to my cordova project, Google Signin uses the app package name and certificate fingerprint to get the correct credentials. Please correct me if I'm wrong, but it works for my app without ;)

Dineshrajaa commented 9 years ago

oh thank you @phw will check and let you know :)

pvharikrishnan commented 9 years ago

i have the same issue , i am getting only the email. after seeing this page, I set offline : true, but i get error: Failed to retrieve token:Unknown

vmlellis commented 9 years ago

I solve this problem enabling Google+ API at Google Developers Console.

pvharikrishnan commented 9 years ago

I have the google+ API enabled. Still getting only the email.

vmlellis commented 8 years ago

@pvharikrishnan Did you create the credential?

I follow these steps:

keytool -exportcert -alias androiddebugkey -keystore <path-to-debug-or-production-keystore> -list -v
jacqueskang commented 8 years ago

Hello mates,

I really need help because I've tried everything I found but still getting "Failed to retrieve token:Unknown" error.

I followed the "Get a configuration file" step in https://developers.google.com/identity/sign-in/android/start where I specified the Application package name copied from AndroidManifest.xml, and the SHA-1 I got using "keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%.android\debug.keystore". After Google Sign-In was enabled sucessfully I can see google has created automatically an API key and a OAuth 2.0 Client ID in the Console, and they looks correct for me.

Then I built my project using "ionic build android" (I'm using Ionicframework) and installed the android-debug.apk on the real device. When window.plugins.googleplus.login({}) is called it shows correctly the sign-in dialog but in the end I only get a JSON object with email. If I add "offline" = true in the option it shows "Failed to retrieve token:Unknown" error.

I've tried the following so far but still can't get it work:

I also have Google+ API enabled.

Please help and thanks very much!

jacqueskang commented 8 years ago

Hi again I finally resolved my problem which was stupid. I actually pasted the wrong SHA1 lol

jalogar commented 8 years ago

Notice that as google uses the certificate of your app for verification purposes, in order to get the complete profile you need to use a signed app. In my case I was only obtaining the email because I launched the app directly with Eclipse and so it wasn't signed. Once I realized the signature was needed and installed a signed app, I correctly got the complete profile.

gowthamravichandran commented 8 years ago

Can someone elaborate on the process what should be done to receive all the details of the user.? I think that would be helpful for many.

Dineshrajaa commented 8 years ago

@gowthamravichandran please check vmlellis comment he has elloborated it

raphaklaus commented 8 years ago

For everyone who have the same problem, after changing my app's package name and apply the SHA-1 fingerprint in the Google Developers Console. What worked for me was:

The package name of my production app was something like com.what.myapp123238. The other OAuth ID was: com.what.myapp123238Staging.

I've changed to com.what.Stagingmyapp123238 and it works.

It seems suffixes are not interpreted well by Google.

steffigratias commented 8 years ago

Hello guys,

This solved my issue of getting only user email id.

screenshot-console developers google com 2016-01-09 18-25-59

The above screenshot appears when you create a project -> Enable Google API -> Go to credentials -> Select the radio button user data

Complete the process & you will get all the userdata.

ghost commented 8 years ago

@All - If you get only email obj then you need to make sure your SHA fingerprint in local app keystore matches with one added to https://console.developers.google.com (Credentials). If it is different you will only get email in (obj).

cesar-moya commented 8 years ago

Hi, i see many people with the issue of only email is being retrieved, this is fixed by making sure that both the package name AND the SHA1 are properly set on https://console.developers.google.com. go to API Manager->Credentials and update your API info. you can retrieve your package name from your config.xml file and/or your androidmanifest.xml file.

image

RahulMiglani commented 8 years ago

Hello,

Is there anyone who can help me with this issue?

I have tried every solutions given here by you all, but only getting email of the user.

Please help me.

I am using MAC, Cordova and IONIC framework.

jacqueskang commented 8 years ago

@RahulMiglani Please double check credentials in Google Console, eg Does package name matches the one in config.xml? Does the SHA-1 certificate matches your debug.keystore?

cesar-moya commented 8 years ago

@RahulMiglani I had the same issue as you, this is fixed by making sure that both the package name AND the SHA1 are properly set on https://console.developers.google.com. go to API Manager->Credentials and update your API info. you can retrieve your package name from your config.xml file and/or your androidmanifest.xml file. you need to double check all your steps. I had the same issue and this fixed it for me.

deliverymanager commented 8 years ago

To get the android debug.keystore SHA1 you may run from anywhere keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

ahmetakin commented 8 years ago

@odindarkester @RahulMiglani Hello,

Your issue probably about non signed apk so you should generate signed apk (With keystore which is you create for Google+ API Client ID) for correctly get all information of users.If you haven't created one yet.

Thanks.

soorajb commented 8 years ago

Try without any options, just the googleplus.login({},function(){alert("yay"0;},function(){alert("boo");}) It doesn't even need the key or anything.

psinghmim commented 8 years ago

I got the SHA1 signature using this command (which was my user id):

keytool -exportcert -keystore ~keytool -exportcert -keystore ~/.android/debug.keystore -list -v

While doing the build, I used sudo:

sudo ionic run android

Since sudo ran as root, a different keystore was used and hence a different SHA1 signature.

It worked once I did the build without sudo, i.e. "ionic run android"

richardmarais commented 7 years ago

I get this issue with iOS. iOS does not use a keystore.

I do have an iOS Credential set up with the Bundle ID matching the widget id in the config.xml. I have also created a Firebase App for my Project that also has the matching Bundle ID (not sure if this has any effect).

When I do this:

        GooglePlus.login({
            'webClientId': webClientId,
            'offline': true
        }).then(googleData => {

The webClientId matches the Client ID in the iOS Credential.

http://stackoverflow.com/questions/42736623/google-firebase-authentication-no-displayname-or-photourl-for-ios