Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are APP_CLIENT_ID and SERVER_CLIENT_ID and where do I find them?

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?

like image 326
Quentin Avatar asked Jun 16 '15 23:06

Quentin


1 Answers

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:

enter image description here

The SERVER_CLIENT_ID string stores a Web server OAuth 2.0 Client ID and is configured from the console as:

enter image description here

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.

like image 198
class Avatar answered Sep 28 '22 11:09

class