Firebase SimpleLogin (Facebook) Failing with Ionic on iPhone - iphone

I've configured Facebook Login, and it works on desktop browsers. However, when using an actual iPhone connected to my laptop, two things happen:
the first time I enter my login details (with Cordova in-app browser), Facebook gives me this page: http://cl.ly/image/0n3Z083o2H0j
after I close and reopen the app, I look in GapDebug and see a request to something like https://auth.firebase.com/auth/facebook/callback?code=YDFasdfjsdfh893&fb_redirect_uri%22%3A%22file... with an error message "Failed to load resource: You do not have permission to access the requested resource."
It looks like the fb_redirect_uri is trying to get a file path instead of a URL -- is that right? Do I have a data access problem or what?

Not sure exactly what was going on, but I updated AngularFire and FirebaseSimpleLogin and then it worked.

Related

TWA bases app sometime showing URL and sometime working, even Assetlink.json uploaded properly

I have website (https://www.kriscent.com/product/kart-supermarket/). I created PWA of that after that I uploaded it on Play store by using TWA(Trusted Web Activities), App URL is https://play.google.com/store/apps/details?id=in.kriscent.kartlite.
The URL of website always show in app, So I uploaded the assetlink.json (URL: https://www.kriscent.com/.well-known/assetlinks.json).
After uploading the assetlinks.json, When I run my app, the website URL disappeared but when I switched on other link in the app then the URL shows again.
I don,t know what is happening. Please help me if anybody has idea to resolve this issue.
enter image description here
enter image description here
The problem is that, when navigating to a product detail page, you are using a different origin than the one used to open the Trusted Web Activity and that doesn't have Digital Asset Links setup:
When the application is started, it opens https://www.kriscent.com/, which is correctly validated.
When clicking on a product, the user is take to https://kriscent.com/ (without www), which is a different origin, and is not validated in the Android app.
It is possible to get the Trusted Web Activity to work with multiple origins but, in this case, I'd recommend using a single origin for the initial URL and the navigations, as you will be able to take advantage of using the same service worker, browser storage, etc.

How to debug on Facebook Internal Browser (Mobile)?

I'm developing website with a lot of HTML5 and CSS3 features. I'm also using iframe to embed several content on my website. It works fine if I open it using Chrome/Firefox/Safari mobile browser. However, if I share on facebook (post/page) and I opened it up with Facebook application with Facebook Internal Browser, my website is messed up.
Is there any tools or way to debug on Facebook Browser? Thanks.
This is how you can do the debugging yourself. It's painful, but the only way I've come across so far.
tl;dr Get the Facebook App loading a page on your local server so you can iterate quickly. Then print debug statements directly to the page until you figure out what is going on.
Get a link to a page on your local server that you can access on your mobile device (test in mobile safari that it works). See this to find out your local IP address How do you access a website running on localhost from iPhone browser. It will look something like this
http://192.xxx.1.127:3000/facebook-test
Post that link on your Facebook page (you can make it private so your friends aren't all like WTF?)
Click the posted link in the Facebook mobile App and it will open up in Facebook's mobile browser
Since you don't have a console, you basically need to print debug statements directly to the page so it is visible. Put debug statements all over your code. If your problems are primarily related to CSS, then you can iteratively comment out stuff until you've found the issue(s) or print the relevant CSS attributes using JavaScript. Eg something like (using JQuery)
function debug(str){$('body').append("<br>"+str);}
Quite possibly the most painful part. The Facebook browser caches very aggressively. If you are making changes and nothing has happened, it's because the content is cached. You can sometimes resolve this by updating the URLs, eg /facebook-test-1, /facebook-test-2, or adding dummy parameters eg /facebook-test?dummy=1. But if the changes are in external css or js sheets it sometimes will still cache. To 100% clear the cache, delete the Facebook App from your mobile device and reinstall.
The internal browser the Facebook app uses is essentially a uiWebView. Paul Irish has made a simple iOS app that lets you load any URL into a uiWebView which you then can debug using Safari's Developer Tools.
https://github.com/paulirish/iOS-WebView-App
I found a way how to debug it easier. You will need to install the Ghostlab app (You have a 7-day free trial there, however it's totally worth paying for).
In Ghostlab, add the website address (or a localhost address) you want to debug and start the session.
Ghostlab will generate a link for access.
Copy that link and post it on Facebook (as a private post)
Open the link on mobile and that's it! Ghostlab will identify you once you open that link, and will allow you to debug the page.
For debugging, you will have all the same tools as in the Chrome devtools (how cool is that!). For example, you can tweak CSS and see the changes applied live.
If you want to debug a possible error, you can try to catch it and display it.
Put this at the very top of your code:
window.onerror = function (msg, url, lineNo, columnNo, error) {
var string = msg.toLowerCase();
var substring = "script error";
if (string.indexOf(substring) > -1){
alert('Script Error: See Browser Console for Detail');
} else {
var message = [
'Message: ' + msg,
'URL: ' + url,
'Line: ' + lineNo,
'Column: ' + columnNo,
'Error object: ' + JSON.stringify(error)
].join(' - ');
alert(message);
}
}
(Source: MDN)
This will catch and alert your errors.
Share a link on Facebook (privately), or send yourself a message on Facebook Messenger (easier). To break the cache, create a new URL every time, e.g. by appending a random string to the URL.
Follow the link and see if you can find any errors.
With help of ngrok create temporary http & https adress instead of your ordinary localhost:3000(or other port) and you could run your app on any devices. It is super easy to use.
and as it was written above all other useful information you should write somewhere inside div element (in case of React I recommend to put onClick on that div with force update or other function for getting info, sometimes it helps because JS in FB could be executed erlier than your information appears). Keep in mind that alerts are not reliable, sometimes they are blocked
bonus from ngrok that in console you will see which files was
requested and response code (it will replace lack of network tab)
and about iFrame.If you use it on other domain and you rely on cookies - you should know that facebook in-app browser blocks 3rd party cookies
test on Android and iOS separately because technicaly they use different browsers

FB login fails after duplicating xcode project to create lite version of app

I created an iPhone app that posts to Facebook, successfully. I then duplicated the app to create a lite version and did the following:
I created a new story and action in FB for the post, for which I:
Added a new namespace for the lite version
entered the bundle identifier for my lite app
entered the FB site login URL to point to a new html file which I copied from the full app (and updated the contents of that file to ensure it had the right App ID and namespace)
updated my app:
changed the FB App ID in my app on the Info page
updated the URL Scheme in the URL Types section of the Info page
updated all occurrences of the FB namespace from the full app's namespace to the lite app's namespace
...but when I run the app (on a device), it doesn't work and fails with the following:
Domain=com.apple.accounts Code=7 "The operation could not be completed" & "An unknown error occurred"
I've not posted any code as the code itself hasn't changed and works perfectly on the full version. I'm missing something (probably obvious!). Any pointers greatly received :-)
Many thanks
I missed something really obvious! In trying to duplicate everything I had done for the full app, I, correctly, added a test user to the Facebook app but I forgot to login to that test user account on Facebook and accept the request!
Hope that helps someone else :-)

Google OAuth not working on iOS

Trying to get my head around OAuth 2.0. I am building a cross platform google drive app using PhoneGap Build and JQM.
I am able to format the request URL correctly and on both iOS and Android. It prompts the user for ID/PW using InAppBrowser (tried child browser too). Next user gets prompt with blue button on web page to "Allow Access" just like on other google web sites/apps. On Android all is well user taps allow access and callback finds the success code and I can grab the token. On iOS I get a "Load Error" message in the status bar of InAppBrowser but I can't trap the error to see what it is. It seems as if the redirect parameter breaks things before the startLoad or endLoad event can be called to trap success/failure in the response from Google.
Playing with oauth2-playground my URL looks correct and like I said it is working fine on Android.
Anyone have any ideas what differences I need to look at with regard to iOS? Been stumped here for a couple of days. Any and all help greatly appreciated.
I have tried redirecting back to http//localhost and http//localhost/afterOauth.html where afterOauth.html is a page in the app to give the redirect something to call the startLoad/endLoad event.
Update: I really think the problem has something to do with the redirect I give the original Google request. If I change "localhost" to urn:ietf:wg:oauth:2.0:oob which shows up in the google documentation both Android and iOS behave the same. They take me to a page saying "Please copy this code, switch to your application and paste it there" With the code=4/MyCode below it.
Also, I added a loaderror callback. It does not fire on Android but does on iOS giving error code -1004 and error message: could not connect to the server. However in the event.url of this loaderror it clearly shows the code=4/myCode. What is the missing link here for iOS and successful OAuth between Google?

New App 404 - Very Basic Setup - URL Exists

I have created a new Facebook app. Whenever I visit the canvas page (https://apps.fac...) I get redirected to the Facebook 4oh4 page.
The canvas URL is set to: https://mgnewmedia.com/brandgame/
Which you will see is as basic as it could possibly be, yet I still get a 404.
I have used the debug tool, which does read it fine. I have checked the URL on other Internet connections and on other Facebook accounts, all 404. The app's canvas page is: https://apps.facebook.com/brandgame/
I have deleted the app and re-added it with no luck. I have also tried putting sample apps in place incase it's 404'ing due to no SDK being present, but that's not the case either.
I have a full, valid SSL certificate in place on the hosting, as you can see. I run several apps on here already with no such issues.
Full list of settings below:
App ID/API Key:
**
App secret:
**
App Namespace:
brandgame
Canvas Page:
https://apps.facebook.com/brandgame/
Canvas URL:
https://mgnewmedia.com/brandgame/
Secure Canvas URL:
https://mgnewmedia.com/brandgame/
Canvas FBML/iframe:
iframe
Contact Email:
**
Support Email Address:
**
App Description:
If you havent changed anything it will just be the delay in the setup as everything seems to be working fine here?
Can provide screenshot's if you want?
This was a bug with Facebook, it was listed on their Bug list tracker shortly after I posted this. It has not yet been resolved, but a work around has been posted. Essentially you add the app, rename it, then rename it back, waiting 20mins or so between each step.
It's worth noting that this doesn't affect everyone making apps, only certain accounts. I assume this is down to data centre allocation, or something such like.