Pre-Sales Q: Auto Login with Custom URL?

I currently run a magazine WordPress site and looking into migrating to Ghost. The only requirement I can’t find Ghost information about is a feature we offer our school and public library subscribers: the ability to use a custom URL to login to our site. This URL is shared with teachers, students, and links on school/library websites. It avoids having to share a login with lots of people.

In WordPress, I use a custom field in the subscriber add/edit page to hold the custom path value and in the functions.php script I have a simple lookup to confirm if the custom value is present. If it is present, then I set cookies and route the person to the home page.

My question: is this sort of customization possible with hosted Ghost (ideally)? Or self-hosted Ghost?

Thank you for any information/ideas.

This doesn’t exist natively in Ghost. However, it wouldn’t be too bad to set up a cloud function that receives visits to this link, and then creates a user account (if needed) and sends the user to Ghost to get a cookie. It’d work self-hosted or on Ghost Pro.

Could you please expand on this?

@Cathy_Sarisky how would this work? I’m not 100% familiar with Ghost so I’m not sure if a “cloud function” is something that’s part of hosted Ghost? I’m also seeing lots of forum references to “magic links” but don’t see documentation: is that a possible solution?

The problem to solve is how to share one account with students and teachers without having to share the login details and thus access to account information like payment etc.

My current WordPress solution is to create one user account and for user accounts to have a single field that contains the custom portion of the site URL. So site.com/customURLfield. So the URL processing would look for the custom URL field in user accounts and, if found, would log the person in automatically. I’m trying to find out how to solve this problem with Ghost.

(Clarification: I’m not the Ghost team. I’m a freelancer and huge fangirl. Folks who work for Ghost have a “staff” badge. You can also reach the Ghost Pro folks at support@ghost.org. I think I can help you with this question, but I didn’t want you to think I was representing the Ghost team… )

By a cloud function I meant something externally hosted. Basically, it would receive requests for this alternate login from users, and get them logged in to some sort of ‘dummy’ account.

Ghost’s only built-in login mechanism is the magic link, meaning you put in your email address and receive a link in email that you have to click. That link takes you to the website and gives you a cookie that identifies you as logged-in.

That process won’t work for shared access at all. You’d need something different. I’ve built Ghost institutional access based on IPs, and I’ve built SSO/social sign-on for Ghost, so I’m quite confident that it can be done, but it’d have to run separately from your hosted Ghost, and would just “talk” to it via the API.

@Cathy_Sarisky this is really interesting and presumably useful in the future for anyone else searching the forum for this kind of issue. Thank you for that. And Jon in support told me you’re an excellent programmer but not staff so that’s fine too.

I’ll email you offline. Thanks again!

1 Like