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:

1 Like


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


Does anyone know if support for membership in a headless context something we’re likely to see in Ghost v5 or in a future version? I’ve been running up against this issue as well and haven’t been able to work out an eloquent solution.

I do know that it’s possible to get your members information from the Ghost Admin API, using this in conjunction with something like Netlify Identity might be a good starting point?

1 Like

But does the Content API account for free and paid content? I was under the impression that it doesn’t, but looking at the posts res I can see there is a "visibility": "public" prop. Does this represent membership viability of content?

I also do hope the Membership function will be released eventually for us to tap on Ghost’s built-in security ecosystem to access “Members-Only” content.

From what I do understand from past interactions with the Ghost team:

  1. The Content API does only provide “visibility” access for posts, meaning you can only “GET” articles. But you will be unable to access “Members-Only” content with a “magic-link login process” before websites that run a headless setup + NextJS can allow readers to access the “Members-Only” content.

  2. The Admin API has some options to access the “magic-link” for subscription, but it is Highly NOT Recommended to use it as a means to access “Members-Only” content, as the API is meant more for “authors access” rather to “readers access”.

  3. Ultimately, at this point I only understand the “Memberships” function is potentially in the works, if you look into Ghost’s Core code, but there is no clear timeline whether when this may work out.

I myself really would like to look forward to the implementation as my recent build at is sort of a fully functioning NextJS implementation with Ghost backend. I would just love to see having the subscription portion fully functioning so more “Member-Only” content can be prepared. ;)

1 Like

That’s right! But you’ll need to use the Admin API to get all the info you need. From what I recall the Content API will only return things that are public, using the Admin API but the same request will get you all the posts regardless of visibility. You’ll also get member information, which you can cross reference with the posts. Don’t quote me though, I’m recalling most of this from memory :sweat_smile: