nraboy / ngx-cordova-oauth

Angular oauth library for use with Apache Cordova projects
MIT License
128 stars 65 forks source link

Cannot authenticate via web Browser #75

Open victjam opened 6 years ago

victjam commented 6 years ago

I just follow the examples and when compile the app to my phone(android) and click login it says that. Somebody can help me? or tell me what is the right configuration in the facebook console.

my register component look like this.

import { Component, OnInit } from '@angular/core'; import { Facebook, Google, LinkedIn } from 'ng2-cordova-oauth/core'; import { OauthCordova } from 'ng2-cordova-oauth/platform/cordova';

@Component({ selector: 'app-register', templateUrl: './register.component.html', styleUrls: ['./register.component.scss'] }) export class RegisterComponent implements OnInit { private oauth: OauthCordova = new OauthCordova(); private facebookProvider: Facebook = new Facebook({ clientId: '**********', appScope: ['email'] }); constructor() {}

ngOnInit() {}

login() { this.oauth.logInVia(this.facebookProvider).then( success => { alert('RESULT: ' + JSON.stringify(success)); }, error => { alert('ERROR: ' + error); } ); } }

my register.html like this

<div class="network col-12"> <button (click)="login()" class="btn btn-primary connect">Sign Up With Facebook</button> </div>

brunobastosg commented 6 years ago

You need to use class OauthBrowser (located in ng2-cordova-oauth/platform/browser) instead of OauthCordova.