I have an Ionic2
app that I would like to add GooglePlus Authentication
to.
I get the following error:
As far as I understand, it's because I have not set up a redirect_uri
.
Question
What redirect_uri
(Authorized redirect URIs
) should I use for an Ionic2 app? Where do I find it?
The following works with Facebook
login.
UPDATE
Following these instructions, I changed the REVERSED_CLIENT_ID
to the following format:
"com.googleusercontent.apps.uniqueId"
So I think I have made progress.
I now get the following error in iOS
:
From reading here, this means that the credentials
should not be created for a Web Application
here. But if I create it for iOS
, how will this work for Android
? Or does Android
not make use of these credentials anyway?
For Android
, when I try to log in, I just get an exception with an undefined
error message.
So I have two questions please:
iOS
client ID here instead of a Web application
?Android
?UPDATE
For iOS
I added an iOS Client Id
and changed my REVERSED CLIENT ID to match, and like with Android
, it prompted me to sign into my Google Account. So that looks like further progress.
However, once I sign in, like with Android
now I get an exception with the message as undefined
. In the Xcode
console, however, I do get the following:
com.google.HTTPStatus error 400.
Following these, I have now created credentials for both iOS
and Android
.
I have configured Android
and iOS
IDs in the new IDs.
I get an exception with the message as undefined
on both Android
and
iOS.
UPDATE
Got it working for iOS
. The webClientId
option when you call login
must not be the reversed client id, but rather the client id.
GooglePlus.login({
'webClientId': 'xxxxx.apps.googleusercontent.com',
'offline': true
}).then(googleData => {
Now to figure out why Android
doesn't work.
In Android, I now get error = 12501
(which is a result of something wrong with my Keystore I think).
UPDATE
I generate the Keystore. As per these instructions, I copy the SHA1
to the Signing-certificate fingerprint
. But still get error = 12501
.
As you got iOS working, here is solution for Android
.
Build APK of your app and then run this command-
keytool -list -printcert -jarfile app.apk
The output will reveal the Signature
, Certificate fingerprints (MD5, SHA1 and SHA256)
and Extensions
of the APK.
Copy the SHA1
to the Signing-certificate fingerprint
while creating client ID for android
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With