How do I handle the Firebase Simple Login for facebook callback in phonegap? - facebook

Building first firebase app using phonegap and angularjs. It authenticates fine in Chrome and I get back the fb user id.
My problem is when I build it with phonegap 2.9 and login with facebook I get nothing but a white screen after login.
My limited understanding is that I'm probably not handling the callback correctly.
In my console logs I see:
Finished load of: https://auth.firebase.com/auth/facebook/callback/?firebase=mementomori
&internalRedirect=false&code=AQDLp_n5_JCnC4yc1OXcXhd2Xfty_UHy_2bmOpR
-JIbyeEZQfh9LCf02deQkXbtXQknxYpTf_XHGFiy4DB1S4Do6fILTmFZ2_z
-S_N872VhwtlWkkOam4I9iMKoqa8PF43jIIdfvTpg8CwPZMs3YrVwqwuJRKzkovBL6nWI8vtdSa
_CFnEhHanXHoaJ3mH7d2vmbhmNGusBkfRdqXnd3LEC1rUyY7hrEr4pfN3BCRAzzgY_
YTot0CUoqRImLPAI76qc18KWaCytZ0ueaMnH7zavkvNExpVSiKlPQBdLUQmFmZQa
FQc6gNWm3dfZTAJw9hLg#_=_
Can anyone offer any information on how I should handle this callback properly?
Solution
I got around my issue by logging in with the native phonegap fb plugin and then passing the auth tocken to firebase for authentication.

If you're using Firebase Simple Login with Phonegap, there are a few prerequisites:
You've included phonegap.js or cordova.js in your application.
Enabled the InAppBrowser plugin in your application.
With both of the above configured, Firebase Simple Login will behave equivalently in PhoneGap as in on desktop / web, where the callback you passed to the Simple Login constructor is invoked with login error or user object. Hope that helps!

Related

How to get data from Cordova's in-App Browser

I'm working on authentication for an Ionic 4 app. I'm using the in app browser plugin to login. After successful login an access token is sent back to the client. I can't figure out how to get the token from the In-App Browser to the app.
You can use an event listener such as :
this.browser.on('loadstart').subscribe(event => { this.checkForToken(event); })
Where checkForToken can look at your "event.url" and parse the token to be stored to localStorage or some other method to be used to login with once the in-app browser is closed.
Using events to listen for load start and stop was an awesome idea. I was, however, facing another issue. Google doesn't allow sign in using the In-App Browser and I really needed that. After asking around and looking at similar past issues I came across a Cordova plugin called BrowserTab. This was awesome as it's an instance/Custom Tab from chrome so it worked fine with google sign in. Another problem came up. You can't inject Javascript into BrowserTab and there was no way to programmatically close it once done. I looked around some more and that's when Deeplinks came to mind. I used the Deeplinks plugin and passed my access token as a parameter. When the user logs in, the BrowserTab redirects to a Custom URL scheme link for my app with the access token in the URL. Now it works perfectly. I've read somewhere that IOS is getting rid of Custom URL Scheme links. Luckily, it still has support for Universal App Links

How to open the Facebook app during OAuth in Ionic?

I just got my app working with $cordovaOAuth from ng-cordova and I've read and understood all from Nic Raboy's post (http://blog.ionic.io/oauth-ionic-ngcordova/). It works fine: both the inAppBrowser and the authentication itself.
But I want to take it one step further: how can I redirect the OAuth call to the installed app itself? For example, if I was using Facebook OAuth, how can I open the actual Facebook app (if installed - how to check it?) instead of a browser?

meteor - phonegap facebook oauth

so i have a meteor app, and i'm using facebook login (and google etc) for user authentication.
and i'm using MeteorRider which is basically "hijacking" the DOM from my meteor app, this way i get also a phonegap app.
So when using web and clicking on the facebook login, its working great.
but when using the phonegap app, its not working. its making an ouath call (opening a browser and do all the process but does not automatically close the browser and bring up my app) but then redirect to my app in the browser.
i'm still trying to figure how the two works with each other.
do i need to do this authentication using phonegap api or should i handle it using meteor api?
I use this for any oauth requirements in phonegap. https://github.com/oauth-io/oauth-phonegap
It handles closing of the browser etc.
I just released a package to fix this. It uses the InAppBrowser plugin to load the popup, listens for the auth token, closes the popup and logs in/creates account.
https://atmosphere.meteor.com/package/phonegap-oauth

oAuth2 Issue in Salesforce PhoneGap iPhone Application (Remote Access Application Authorization Issue)

I have created an iPhone application using PhoneGap. I have followed code from this tutorial:
Building PhoneGap Mobile Applications Powered by Database.com
I have logged in successfully and got struck in this screen:
I am unable to move to other screens to access data. Here is the url that got generated after successful login:
https://login.salesforce.com/services/oauth2/success#access_token=0000&refresh_token=0000&instance_url=https%3A%2F%2Fna12.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%000C&issued_at=0000&signature=qqqq&scope=id+api+refresh_token
Do I need to add cosumer key to this url? Here is my callbackurl:
https://login.salesforce.com/services/oauth2/success
What would be the problem? Did I miss anything?
So https://login.salesforce.com/services/oauth2/success is a stub URL for callbacks - and that is the screen you are seeing there, and the access_token variable is your session ID for the user. So the OAuth flow is working correctly.
In the code, you might check to see if:
oauthResponse.access_token
Is getting set correctly. If so it looks like:
sfw.login( setupHomeView );
Is what should tell it to move from that page to the next UI page.
You might also check out the Force.com Mobile SDK:
http://developer.force.com/MobileSDK
It also includes PhoneGap and has a great OAuth wrapper built in.

Facebook Login with Blackberry Webworks

So I'm trying to build a Blackberry Webworks that integrates with Facebook.
I'm trying to use the Javascript API provided by Facebook, but I'm having some issues with logging in.
The typical "FB.login" function creates a popup, and this doesn't show up on a Blackberry so using that is no good.
Another issue is that I have no idea what to set as the redirect_url for the oauth login, because Webworks pages are referenced locally (local://index.html), and the API rejects this as a valid url. (I've also tried just index.html, but this also causes an error)
And finally, I have no idea what to use for the Mobile Website URL on the Application settings and not sure what other settings to use. Since users will be coming from a Webworks app, Facebook is rejecting login requests if I try to call the oauth url directly. (191 Error).
I figured out the only viable way to do this is to have a web server that will go through the OAuth2 authentication process documented by Facebook.
What you can do in Blackberry is open a new window or to use a Blackberry BrowserField that links to the web server, that way, your page will be able to get the oauth token that you can use to make Graph API calls.