Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Commit fc23056

Browse files
# Conflicts: # README.md
2 parents 71646e3 + bd0261b commit fc23056

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Android
2727
<img src="https://raw.githubusercontent.com/EddyVerbruggen/cordova-plugin-googleplus/master/screenshots/Android3.png" width="235" height="400"/>
2828

2929
iOS
30-
30+
3131
<img src="https://raw.githubusercontent.com/EddyVerbruggen/cordova-plugin-googleplus/master/screenshots/iOS1.png" width="235" height="417"/>&nbsp;
3232
<img src="https://raw.githubusercontent.com/EddyVerbruggen/cordova-plugin-googleplus/master/screenshots/iOS2.png" width="235" height="417"/>&nbsp;
3333
<img src="https://raw.githubusercontent.com/EddyVerbruggen/cordova-plugin-googleplus/master/screenshots/iOS3.png" width="235" height="417"/>&nbsp;
@@ -36,7 +36,7 @@ Android
3636
To communicate with Google+ you need to do some tedious setup, sorry.
3737

3838
### iOS
39-
To get your iOS API key, follow Step 1 of [this guide](https://developers.google.com/+/quickstart/ios)
39+
To get your iOS API key, follow Step 1 of [this guide](https://developers.google.com/+/mobile/ios/getting-started)
4040
[get a configuration file here](https://developers.google.com/mobile/add?platform=ios&cntapi=signin).
4141
This `GoogleService-Info.plist` file contains the `REVERSED_CLIENT_ID` you'll need during installation.
4242

@@ -99,6 +99,7 @@ window.plugins.googleplus.login(
9999
{
100100
'scopes': '... ', // optional space-separated list of scopes, the default is sufficient for login and basic profile info
101101
'offline': true, // optional and required for Android only - if set to true the plugin will also return the OAuth access token, that can be used to sign in to some third party services that don't accept a Cross-client identity token (ex. Firebase)
102+
'webApiKey': 'api of web app', // optional API key of your Web application from Credentials settings of your project - if you set it the returned idToken will allow sign in to services like Azure Mobile Services
102103
// there is no API key for Android; you app is wired to the Google+ API by listing your package name in the google dev console and signing your apk (which you have done in chapter 4)
103104
},
104105
function (obj) {
@@ -140,7 +141,8 @@ The code is exactly the same a `login`, except for the function name.
140141
```javascript
141142
window.plugins.googleplus.trySilentLogin(
142143
{
143-
'offline': true // optional and required for Android only - if set to true the plugin will also return the OAuth access token, that can be used to sign in to some third party services that don't accept a Cross-client identity token (ex. Firebase)
144+
'offline': true, // optional and required for Android only - if set to true the plugin will also return the OAuth access token, that can be used to sign in to some third party services that don't accept a Cross-client identity token (ex. Firebase)
145+
'webApiKey': 'api of web app' // optional API key of your Web application from Credentials settings of your project - if you set it the returned idToken will allow sign in to services like Azure Mobile Services
144146
},
145147
function (obj) {
146148
alert(JSON.stringify(obj)); // do something useful instead of alerting

src/ios/GooglePlus.m

+7-1
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@ - (GIDSignIn*) getGIDSignInObject:(CDVInvokedUrlCommand*)command {
127127
NSString *clientId = [self reverseUrlScheme:reversedClientId];
128128

129129
NSString* scopesString = [options objectForKey:@"scopes"];
130-
130+
NSString* serverClientId = [options objectForKey:@"webApiKey"];
131+
131132
GIDSignIn *signIn = [GIDSignIn sharedInstance];
132133
signIn.clientID = clientId;
134+
135+
if (serverClientId != nil) {
136+
signIn.serverClientID = serverClientId;
137+
}
138+
133139
signIn.allowsSignInWithBrowser = NO; // Otherwise your app get rejected
134140
signIn.uiDelegate = self;
135141
signIn.delegate = self;

0 commit comments

Comments
 (0)