ronzeidman / ng2-ui-auth-example

MIT License
34 stars 14 forks source link

Quick question about ionic #7

Closed speedfl closed 7 years ago

speedfl commented 7 years ago

Hello.

First of all thanks a lot for your updates on this project and for the example you created. Howevet I have small questions about ionic :

Thanks for your answer

ronzeidman commented 7 years ago

Can you elaborate what you mean by: "We would nees inapp browser no like on the satellizer project"

@royipressburger can you help?

speedfl commented 7 years ago

sorry it is a typo because of my phone

In fact I would like to know if we would need the cordova plugin inapp browser like in satellizer.

To be honnest I never used satellizer. I am working on Ionic 2 so when I saw your project I run on it and started trying to understand. I followed the complete flow but facebook is not called when I am running ionic serve

speedfl commented 7 years ago

So basically what I did:

Clone the repo. Did npm install on the ionic folder

Some changes as in fact there is only the basic login

ng2-ui-auth-example\ionic2\src\pages\login\login.html => <button ion-button (click)="signup()">Signup

ng2-ui-auth-example\ionic2\src\pages\signup\signup.html => <button ion-button (click)="signup('facebook')">Login facebook

g2-ui-auth-example\ionic2\src\pages\signup\signup.ts =>

 signup(provider){
  console.debug('launch signup');
  this.auth.authenticate(provider);
 }

So Working with ionic serve. Just to know if it we need to use the inapp browser and how to use it of cordova :)

royipressburger commented 7 years ago

Hi @speedfl, if you use this library you will the in app browser. The steps to work with facebook:

  1. Make sure you redirect url us http://localhost/ NOTE that the /at the end is mandatory
  2. Install cordova-inappbrowser
  3. Make sure that on Facebook console you add the url http://localhost/

Hope this helps

speedfl commented 7 years ago

Thx I will try to follow your explanation

speedfl commented 7 years ago

Euh just another question. I did a java auth server using jaxrs (based on the example provided by satellizer with some changes to map my need) However I am getting error. Unrecognized field 'url' not marked as ignorable It is due to the fact that I am receiving in my request a field called url and I am trying to map in an object which does not contain it. Could you please tell me where I can find the full content of the request sent to the server for facebook login ?

royipressburger commented 7 years ago

The request you are talking about is from the ui to your server after the authentication with Facebook?

speedfl commented 7 years ago

So you can close the issue :) sorry for the inconveniance

What is sent is:

{ "name": "facebook", "url": "/auth/facebook", "authorizationEndpoint": "https://www.facebook.com/v2.5/dialog/oauth", "redirectUri": "http://localhost:8100/", "requiredUrlParams": [ "display", "scope" ], "scope": [ "email" ], "scopeDelimiter": ",", "display": "popup", "oauthType": "2.0", "popupOptions": { "width": 580, "height": 400 }, "clientId": "CLIENT_ID", "defaultUrlParams": [ "response_type", "client_id", "redirecturi" ], "responseType": "code", "responseParams": { "code": "code", "clientId": "clientId", "redirectUri": "redirectUri" }, "code": "THE CODE HERE", "": "_" }

I finally understood what is happening. I made a fix. If you want to have an example using jaxrs for the server don't hesitate to ask me :)

royipressburger commented 7 years ago

Cool.. good luck

ronzeidman commented 7 years ago

Thanks @royipressburger

speedfl commented 7 years ago

@royipressburger I would just have a little question. I installed the inappbrowser and it seems to be launched

However I am getting issue: The redirect_uri is not supported

If I am looking at the redirect_uri sent I am getting : redirect_uri=file:///

The issue only occures when I am connecting on my device. On browser with ionic serve everything is working.

Is there specific things to do?

royipressburger commented 7 years ago

@speedfl Did you extend the CustomConfig and changed to redirect_uri?


export class MyConfig extends CustomConfig {
    providers = {
      facebook: {
        clientId: CONFIG.FACEBOOK_KEY,
        scope: CONFIG.FACEBOOK_PERMISSION,
        redirectUri: 'http://localhost/'

       }
    };
}
speedfl commented 7 years ago

Hello Sorry I thought I had to put it only on the Facebook developer page (on my app) I will try,

Thanks a lot :)

I will keep you posted.

speedfl commented 7 years ago

works!! Thanks a lot!

royipressburger commented 7 years ago

@speedfl any time bro!! good luck