Auth0 Home Blog Docs

Social login works on Chrome but not on Android Emulatr



Hi guys,

I´m trying to setting up and managing authentication in my Ionic apps using Auth0. I had followed the tutorial from official site (, but seems that something is going wrong.

When I log in with my email/password everything works fine, either on Chrome or via “ionic run android” command (Android Emulator). But when I try to do it through social networks (Facebook, Twitter, etc), it only works on Chrome, and not on Android Emulator.

The worst thing about is that remote inspect is not throwing any error, but It just redirects back to my “loading forever” login screen…

Can anyone help me please with that sh*?

I am just about to going crazy!!

More details about my application below…

Here is my .run block in app.js:

.run(function($ionicPlatform, $rootScope, $timeout, $ionicHistory, AuthService) {
  $ionicPlatform.ready(function() {
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
    if(window.StatusBar) {

    // Register the authentication listener that is
    // set up in auth.service.js

    //This event gets triggered on URL change
    $rootScope.$on('$locationChangeStart', AuthService.checkAuthOnRefresh);

  // Check is the user authenticated before Ionic platform is ready
Now, my config block still in app.js:

.config(function($urlRouterProvider, $stateProvider, $httpProvider, $ionicConfigProvider, lockProvider, jwtOptionsProvider) {

    clientID: AUTH0_CLIENT_ID,
    domain: AUTH0_DOMAIN,
    options: {
      auth: {
        redirect: true,
        params: {
          scope: 'openid',
          device: 'Mobile device'
      language: 'pt-BR',
      languageDictionary: {
        title: ''
      theme: {
        primaryColor: '#DF6F39',
        logo: ''

      socialButtonStyle: 'small'

  // Configuration for angular-jwt
    tokenGetter: function() {
      return localStorage.getItem('id_token');
    whiteListedDomains: 'localhost'],
    unauthenticatedRedirectPath: '/login'

    .state('tab', {
    url: '/tab',
    abstract: true,
    views: {
      '': {
        templateUrl: 'templates/tabs.html',
        controller: 'TabCtrl'
  .state('login', {
     url: '/login',
     templateUrl: 'templates/login.html',
     controller: 'LoginCtrl'
  // if none of the above states are matched, use this as the fallback

Now, Here is my AuthService:

.service('AuthService', function($rootScope, lock, authManager, jwtHelper, $location, $ionicPopup, $q, StorageService) {

  var userProfile = JSON.parse(localStorage.getItem('profile')) || {};

  var deferredProfile = $q.defer();
  if (userProfile) {

  function login() {;

  // Logging out just requires removing the user's
  // id_token and profile
  function logout() {
    userProfile = {};

  // Set up the logic for when a user authenticates
  // This method is called from
  function registerAuthenticationListener() {
    lock.on('authenticated', function(authResult) {
      localStorage.setItem('id_token', authResult.idToken);

      // Redirect to default page
      location.hash = '#/tab/map';

      lock.getProfile(authResult.idToken, function(error, profile) {
        if (error) {
        localStorage.setItem('profile', JSON.stringify(profile));

  function getProfileDeferred() {
    return deferredProfile.promise;

  function checkAuthOnRefresh() {
    var token = localStorage.getItem('id_token');
    if (token) {
      if (!jwtHelper.isTokenExpired(token)) {
        if (!$rootScope.isAuthenticated) {

  return {
    userProfile: userProfile,
    userSettings: userSettings,
    login: login,
    logout: logout,
    registerAuthenticationListener: registerAuthenticationListener,
    checkAuthOnRefresh: checkAuthOnRefresh,
    getProfileDeferred: getProfileDeferred

Libraries references added to my application’s index.html:

<!-- lock 10 -->
<script src="lib/auth0-lock/build/lock.min.js"></script>
<!-- angular-lock 1.0.5 -->
<script src="lib/angular-lock/dist/angular-lock.min.js"></script>
<!-- angular jwt 0.1.9 -->
<script src="lib/angular-jwt/dist/angular-jwt.min.js"></script>

My system info:

Cordova CLI: 6.4.0

Ionic CLI Version: 2.1.12

Ionic App Lib Version: 2.1.7

ios-deploy version: Not instal

ios-sim version: Not installed

OS: Windows 10

Node Version: v6.9.1

Xcode version: Not installed


Hi Abhishek,
Just recreating the topic…
Please, tell me when we can go for a call.
I am available every morning until 9:30 am and at night from 20:00 on…
If it´s 10 am the only time you can go for a call, tell me so I can adapt myself.