I'm trying to implement server-side API access for my iOS app. The Google docs (here) mention APP_CLIENT_ID
and SERVER_CLIENT_ID
in their code sample in step 2.
Here's their code:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GIDSignIn sharedInstance].clientID = @"APP_CLIENT_ID";
[GIDSignIn sharedInstance].serverClientID = @"SERVER_CLIENT_ID";
// Additional scopes, if any
// [GIDSignIn sharedInstance].scopes = @[ @"other_scope" ];
return YES;
}
What are APP_CLIENT_ID
and SERVER_CLIENT_ID
and where do I find them? Are they both in the Google Developers Console?
Replace the APP_CLIENT_ID
string with an installed application OAuth 2.0 Client ID for the iOS app, configured by adding credentials with the following radio selected:
The SERVER_CLIENT_ID
string stores a Web server OAuth 2.0 Client ID and is configured from the console as:
The server client ID, listed under "Client ID for web application" in the console, is only used if you retrieve an authorization code to authorize your server in hybrid authorization scenarios and is optional. When specifying a SERVER_CLIENT_ID
, you retrieve an authorization code and can exchange the code for a refresh token on your backend services when you authorize the user from the iOS app.
The client IDs traditionally have been configured via the Google Developer Console as described here. However, using the latest libraries, you can generate a configuration and load it as explained in the iOS developer guide for Google Sign-In.
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