Google Authentication

Ionic Cloud has been deprecated. To continue using Ionic services, migrate to Ionic Pro before Jan. 31, 2018.


Native Login

This is the documentation for implementing 3-legged authentication with the InAppBrowser plugin. For native login, proceed to Google Native.

It it highly recomended that you implement native login, as Google will begin to drop support for InAppBrowser authentication on October 20th, 2016 for new projects and will start refusing authentication requests for old ones on April 20th, 2017. Here’s their article discussing it:

Create a Google Project

The first step in setting up your Google authentication integration is to create a project on Google.

You’ll use these details in the next section.

Client ID & Secret

Now that you’ve got an app setup, you need to let us know about the Client ID and Client Secret. You can find both details listed in the dialog referenced above.

App Implementation


Plugin Installation

The InAppBrowser plugin is used to login your users with Google authentication.

$ cordova plugin add cordova-plugin-inappbrowser --save

Injecting Auth and User

Import Auth and User from the Cloud Client and specify them as dependencies in your component constructor.

  • auth is a service that deals with user authentication.
  • user is a reference to the current user, whether that user is anonymous or authenticated.
import { Component } from '@angular/core';
import { Auth, User } from '@ionic/cloud-angular';

@Component( ... )
export class LoginPage {
  constructor(public auth: Auth, public user: User) {

Specify as a dependency for your module. This gives you access to $ionicAuth and $ionicUser.

  • $ionicAuth is a service that deals with user authentication.
  • $ionicUser is a reference to the current user, whether that user is anonymous or authenticated.
angular.module('myapp.controllers', [''])

.controller('MyCtrl', function($scope, $ionicAuth, $ionicUser) {


this.auth.login('google').then( ... );
$ionicAuth.login('google').then( ... );


Logging out clears the current user context.


Social Data

We store social data in Unlike your custom data which uses user.get() and user.set(), is just an object with the following properties.

uid Google user ID
data Google data object
data.profile_picture Google profile picture Google email
data.full_name The user’s full name
data.raw_data The data object straight from Google (see these docs)


const full_name =;
const profile_picture =;
const google_raw_data =;
var full_name = $
var profile_picture = $
var google_raw_data = $;