Trying to get Ionic User working in Ionic 2

Hi,

I’m trying to get cracking with the Ionic platform but can’t figure out what to import to get Ionic Users working.

I’ve got the code from the docs in a click handler and I added ionic-web-platform and did the init too

I get a Cannot find name ‘Ionic’. error when I run the function.

Its a really basic login page with the code as follows:

import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';

@Component({
  templateUrl: 'build/pages/login/login.html',
})

export class LoginPage {
  constructor(public nav: NavController) {

  }

  login(){
    let success = function(user) {
      console.log('Logged me in');
    };

    let failure = function(errors) {
      for (var err in errors){
        console.error('This totally just failed');
      }
    };

    Ionic.Auth.login('facebook', {'remember': true}).then(success, failure);
  }
  
}

I think its simply a matter of importing and then adding to the constructor but I cant seem to find what?

Thanks

I don’t think it’s as simple as that.

Ionic Platform services are not ready for Ionic 2 yet, gotta wait to be able to update it and get it working.

Aah I see.

So I’ll need to implement my own user authentication and so forth.

Are all Ionic Platform services only for version 1 then?

Best

Yep
Platform services supports Ionic 1 only, but the next month we may have something to test with Ionic 2 :smiley:

1 Like

so why is this not explained anywhere? I saw the user auth docs… but nowhere does it say… this doesnt work yet… don’t try to use ionic users?

even in the app if you click users, it says… go get setup over here and points to the users docs…

but nowhere can i find a working user auth example… so why show the backend for users if we can’t add users yet.