Need Help to Enable Members/Paid Users to View Articles on NextJS Build

Hi there,

I’ve recently taken on the challenge to build a custom Frontend using NextJS and having Ghost as a Headless CMS.

More or less most of the basic views, especially “Free Posts” actually loads and work.

What I cannot really wrap around is how to go about setting up to enable existing members to “Login” or “Sign Up” to read the “Members/Paid” articles.

I roughly gauge I might need to use the Admin API. However, I cannot really wrap around whether:

  1. I will have to use AdminAPI to authenticate a member to “login” to read the article
  2. If they login, is there a need to store the token or in some sort of cookie for members to continue to browse freely onsite?
  3. Do I need to really use the separate /admin/posts/{slug} to do another “GET” to pull those posts for reading?—After thinking, it may not be feasible this way as the AdminAPI is mainly for Staff to Create/Edit/Delete new posts, etc. However, I just want the bare minimum of browsing articles, and probably to self-upgrade the different tiers of subscription. I can also see the URL requests require the /admin to do a new request. I’m not sure if it is necessary for access for “Logged-in members”.
  4. How to access the Stripe payments segment? Do I need to self-build a separate callback for it or what should I tap on to access this capability?

Hope someone from the community or the Ghost team may help shed light on the process and what is needed to get done. Many thanks in advance! :slight_smile:

Ghost v4.18.0
NextJS v11.1.2

At this time, Ghost doesn’t have a public members API for members in a headless context. You should not be using the Admin API for actions that would normally be performed by a member - the Admin API is used for actions performed by publication staff.

Hi @vikaspotluri123 ,

Thank you for the heads up on what the Admin API is for.

Given so, does it mean that my NextJS website can only run posts that are for “Free” reading? Is there other alternatives that enable members to read the articles? Hope you can shed some light on that, as I’ve spent quite a bit of time and effort on the project, it would be quite a waste if this part doesn’t work.

Thank you!

Unfortunately all I know is that Ghost doesn’t seem to have support for memberships in a headless context

Got it. Thanks for this info. This is quite a bummer after coming so far. Appreciate that you made time to help update me on this.

I have also found these two links that validate the limitations. Hopefully, there is really something in the pipeline soon given the last discussion was in Jan 2022.

@sgrobert I discovered this limitation as well and posted about it on the forum just a few days ago. In case you’re interested:

Given this limitation, what I’m looking at doing instead of using Ghost as a headless CMS with a static site generator is using which I haven’t used before, but it looks like it is suitable for what I need to do, which is add user accounts and some minimal data persistence to an otherwise static documentation site.

Hi @DonaldH ,

Thanks for the input and sharing! Pretty new news to me on the site conversions.

However, I guess the ideal arrangement will be to use Ghost as a Headless CMS (Just had hoped it did have the Memberships segment included at the moment). I do believe Ghost provides a very simple and comprehensive set up on the backend and for authoring posts especially.

Though does sound like a very interesting project to implement, I guess by removing Ghost from the equation, I would probably have to implement another setup for the posts-authoring, basic payments, on top of the user-account segment, which might be way too much work when Ghost has already done such a great job.

Nonetheless, really appreciative that you have shared the additional input on this.

I guess the simple bottleneck here is really just the "ability to sign up with payments option + login", which will help keep the overall set up simple and clean as well.

1 Like

@sgrobert Yes, absolutely. For your use case, I completely agree that headless Ghost sounds like the way to go :slightly_smiling_face:

1 Like

Did I accidentally time travel? :joy:


Great one! That caught me offguard. But hahaa I saw the post in the “wrong timeline”. Correction: “2020”. :rofl:

1 Like