We’re trying to figure out a way to deal with Facebook’s Mobile Prison Browser (in app browser). Email link authentication is incompatible, it doesn’t even have an address bar and doesn’t open links from email. I need an easy solution and am asking here to simply see if the basics are possible. 80% of my existing following uses FB on mobile where they follow links from the mobile app.
I’m wondering simply if it is possible allow people to say enter a code into a form and then set the cookie.
I know there are many steps to doing so and this isn’t that specific of a request. Just looking to see if it is possible using just say API’s and JS with maybe some code running on an off-site server to assist. I’m worried about security possibly being a roadblock and we are Ghost Pro hosted so we can’t hack the source there and really would prefer to keep our changes within theme uploads.
Our plan is to create a custom login function for FB’s mobile browser that requests their email address, verify that address as a member, then email them a 4 digit code, have them go back and type that into a form, and then set a persistent cookie for authentication just like the email links do. We can reliably detect that browser and already are.
Generally speaking, it should be possible. But you’d need to modify the Ghost core – and given that you’re on Ghost(Pro) that will be the problem, in my opinion.
I found this blog post a few weeks ago, that explains how the Ghost authentication works:
In order to make this work with a code, you’d need to adjust the email that is sent out, create a new form where this is entered, then completely change the createSessionFromMagicLink middleware – and that’s just the tip of the iceberg.
What if a member is changing email addresses? Or signs up? For these, do you want to keep the magic link authentication, or change it to code-based as well?
Thanks. We’re reviewing the XTA Blog carefully. We have a separate server that acts as our back end and can do API calls from there and link the login form for the FB Mobile Browser to that possibly. We don’t want to send magic links because people will just click on those, we want to send a FB-only email with just the code that they will type in.
It seems at first glance that this is possible without hacking the core so long as we can call these functions by API or script somehow:
We can verify the code we create on our back end server and then redirect to:
{main-url}/members/{token}
So in narrowing this down, do you or anyone know if it is possible to call through the API functions that would create the token and then retrieve the token? We can then after people type in the correct code do a simple redirect to the URL using the token that then sets the cookie without modification to that process.
Cathy_Sarisky has SSO working without the need to modify the Ghost core and uses her server to do the SSO verification before handing back to Ghost a redirection URL that is the magic link. We may ask her for professional assistance if we can’t find how to do this more readily.
If you look in her FAQ for " How’d you build it?", her process seems to indicate that there is a way.
Note, we don’t want to introduce SSO right now because it is super busy now for signups and I don’t want to deal with the confusion of SSO emails not matching as we already have about 2,500 subscribers. I would prefer to integrate that in the off-season (summer, we are seasonal).
That’s a good point! Just had a look at the explanation she put there and it’s basically a layer in front of the magic links, rather than trying to replace it.
I did just send her an email. I’m positive this can be done based on what she is doing and I’ll pay her to show us how. My developer can definitely handle coding it all up if he knows what to do.