Skip to content

Login with Google

This guide describes the process of configuring your Backendless backend to enable the Google account sign-in in your application. The result of the integration allows users with Google accounts to login to your app while being represented within the app as BackendlessUser.

Client side setup

Follow the "Google Sign-in with iOS" instructions from:

Configuring Backend

  1. Return to
  2. Select the project and click Credentials.
  3. The credentials should now include a "Web client" which is automatically generated by Google.

  4. Click Web client.

  5. Copy Client ID and Client secret into Google Client ID and Google Client Secret located in the Manage > App Settings > Social Settings in Backendless console:


In order to complete Google Sign-In with Backendless, your application must use the following functions once a delegate for Google sign-in is invoked:

- (void)loginWithGoogleWithAccessToken:(NSString * _Nonnull)accessToken fieldsMapping:(NSDictionary<NSString *,NSString *> * _Nonnull)fieldsMapping responseHandler:^(BackendlessUser * _Nonnull)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func loginWithGoogle(accessToken: String, fieldsMapping: [String: String], responseHandler: ((BackendlessUser) -> Void)!, errorHandler: ((Fault) -> Void)!)


- (void)signIn:(GIDSignIn *)signIn didSignInForUser:(GIDGoogleUser *)user withError:(NSError *)error {
    if(error) {
        NSLog(@"Error: %@", error.localizedDescription);
    else {
        [Backendless.shared.userService loginWithGoogleWithAccessToken:user.authentication.accessToken fieldsMapping:@{@"email": @"email"} responseHandler:^(BackendlessUser *loggedInUser) {
            NSLog(@"User has been logged in");
        } errorHandler:^(Fault *fault) {
            NSLog(@"Error: %@", fault.message);
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
    if let error = error {
        print("Error: \(error.localizedDescription)")
    else {
        Backendless.shared.userService.loginWithGoogle(accessToken: user.authentication.accessToken, fieldsMapping: ["email": "email"], responseHandler: { loggedInUser in
            print("User has been logged in")
        }, errorHandler: { fault in
            print("Error: \(fault.message ?? "")")