Facebook does not work in PWA application if the application is offline

I am creating a PWA website. I am using Angular JS and I used javascript facebook login on my website. But if I view my application in a browser, then facebook login works. But when I add a shortcut to the desktop and launch the application from the desktop, the FB login does not work. Facebook page is loading. But after entering the credentials, a blank page is displayed. Can anyone help?

Here is my FB login

var doBrowserLogin = function(){ var deferred = $q.defer(); FB.login( function(response){ if (response.authResponse) { deferred.resolve(response); }else{ deferred.reject(response); } }, {scope:'email,public_profile'} ); return deferred.promise; } 

The facebook login screen opens and a blank appears after entering the credentials. Do not return to the application. Empty page In my manifest.json file, the display property is set to standalone. Please, help.

+5
source share
1 answer

This is the correct behavior, because the Facebook API for logging in opens a new tab with a login form. Facebook implements the OAuth2 solution and activates the implicit OAuth2 stream to authenticate the user using its API. You must use an authorization code to enter the same window, but it is unsafe for client applications because you will need a secret code that is not accessible to users.

Instead of opening a new tab, you can create an iframe with the facebook login form and close and redirect it when the user logs in.

+1
source

Source: https://habr.com/ru/post/1274526/


All Articles