ronzeidman / ng2-ui-auth

an angular2 repository for authentication based on angular1's satellizer
MIT License
206 stars 64 forks source link

Sometimes I do not receive token from facebook #149

Open tuhin24 opened 6 years ago

tuhin24 commented 6 years ago

Hi Ron, Sometimes, I do not receive the code for facebook login. The body looks like as follows: Any tip on how to resolve this? Thanks

[0] { authorizationData: [0] { response_type: 'code', [0] client_id: '**', [0] redirect_uri: 'http://localhost:4200/', [0] scope: 'public_profile,email', [0] display: 'popup' }, [0] oauthData: { login: true }, [0] userData: {} } [0] r-end [0] (node:83663) UnhandledPromiseRejectionWarning: StatusCodeError: 400 - {"error":{"message":"Missing authorization code","type":"OAuthException","code":1,"fbtrace_id":"DiiMcrEVOek"}}

when it works, the body looks like: { authorizationData: [0] { response_type: 'code', [0] client_id: '*****', [0] redirect_uri: 'http://localhost:4200/', [0] scope: 'public_profile,email, [0] display: 'popup' }, [0] oauthData: [0] { code: 'AQBpl6uaNIp5ApAsc4IvKxw1gZotwbB8g9a4oT3KecWJ6L1yCyX5qnu6vRX7Jjm0JiQQlQrNQQX8hIBlnIBgLoQtZp03Kp2OUQgA1QIN0YEgR4RjuFloP_9u1rlfllEERlzQgxXONdU04WcNC5rzaRZjkgyb6n7v0TuY8llRaiidmNCBgz_qTeOCm6XNS7JY8kcdXrqrkb8o6HLS0qqmnnMVx3D1j6wf8Vujtwym__ZtTiHdbgeasKoNdTHTwthbftYzO0bT0wL7GSYhCqrgdjZwlt5o0yANL8rGg8beCyK-q1u1UCkKLxmBHcrPD6y5NFEHHaUJ7ztkzufXVgY3NMBv3TjoJo4RyLy-Tx2GP4dNQ', [0] : '_' }, [0] userData: {} },

ronzeidman commented 6 years ago

I'm guessing it's a matter of timing, the "redirectUrl" of facebook should not redirect again. This issue usually happens when you configure the redirectUrl to be the base url and it immidiately redirects again removing any query params, you sould redirect to a url that doesn't re-redirect. I hope this explanation was clear enough...