# Build a Secure Blog with React, Gatsby, and Netlify

**URL:** <https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216>\
**Category:** Developer Blog Comments\
**Created:** [February 18, 2020, 4:56pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216 "2020-02-18T16:56:30Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [February 18, 2020, 4:56pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/1 "2020-02-18T16:56:30Z")

</div>

[Build a Secure Blog with React, Gatsby, and Netlify](https://developer.okta.com/blog/2020/02/18/gatsby-react-netlify)

This tutorial shows how to build a secure blog app with Gatsby, React, and Netlify.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [September 29, 2020, 10:16am UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/2 "2020-09-29T10:16:20Z")

</div>

**Henri De Roeck**

Thanks for this post. I understand you want to exclude static generation of secured content (hence: excluding the /account/\* pages), but I don’t understand how the content will be displayed once the user has logged in? Because the CMS API needs to verify the authentication token as well, no?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 6, 2020, 9:53pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/3 "2020-10-06T21:53:09Z")

</div>

**Matt Raible**

The content part of the site doesn’t require authentication and is included at build time. The part that’s secured by Okta is dynamic and requires authentication. Does that help?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 25, 2020, 2:50pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/4 "2020-10-25T14:50:52Z")

</div>

**Anne van Rossum**

Yes, for the reader: this includes authentication, but it’s not **gating content**. It also does not implement **role-based access control**.

This protects the rich-text editing capability from being using by everybody. It’s implementing **access control** for editors.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [May 30, 2021, 9:19pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/5 "2021-05-30T21:19:01Z")

</div>

**nikivancic**

I tried today to run your tutorial in my current environment

System:  
 OS: macOS 11.3.1  
 CPU: (12) x64 Intel(R) Core™ i7-9750H CPU @ 2.60GHz  
 Shell: 5.8 - /bin/zsh  
 Binaries:  
 Node: 14.16.1 - /usr/local/bin/node  
 npm: 7.15.0 - /usr/local/bin/npm  
 Languages:  
 Python: 2.7.16 - /usr/bin/python  
 Browsers:  
 Chrome: 90.0.4430.212  
 Safari: 14.1  
 npmPackages:  
 gatsby: ^3.4.1 =\> 3.4.1  
 npmGlobalPackages:  
 gatsby-cli: 3.6.0

Running the command “npm i netlify-cms-app@2.14.45 gatsby-plugin-netlify-cms@5.3.0” creates a lot of errors of the type **ERESOLVE unable to resolve dependency tree**

Found: react@17.0.2  
npm ERR! node\_modules/react  
npm ERR! react@"^17.0.1" from the root project  
npm ERR!   
npm ERR! Could not resolve dependency:  
npm ERR! peer react@"^16.8.4" from netlify-cms-app@2.14.45  
npm ERR! node\_modules/netlify-cms-app  
npm ERR! netlify-cms-app@“2.14.45” from the root project

In my relatively short life with Gatsby I did not encounter such issue. Is this a time to refresh your tutorial which seems very valuable?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [May 31, 2021, 3:49am UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/6 "2021-05-31T03:49:20Z")

</div>

**Matt Raible**

My guess is you’re using npm 7, which is more strict about peer dependencies. Can you try with npm 6?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [May 31, 2021, 2:38pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/7 "2021-05-31T14:38:23Z")

</div>

**nikivancic**

The issue is being discussed in this thread [https://github.com/gatsbyjs…](https://github.com/gatsbyjs/gatsby/issues/31102 "https://github.com/gatsbyjs/gatsby/issues/31102") . There is also a PR ready to process - the question is only when will that patch get released.

Thanks for this quick response Matt - such behavior is always very appreciated. Also, I was using npm 6.14.7 in my app.

It really bugs me for being stopped in such silly way, as it took me a long time to find the article [Build a Secure Blog with Gatsby, React, and Netlify](https://developer.okta.com/blog/2020/02/18/gatsby-react-netlify "https://developer.okta.com/blog/2020/02/18/gatsby-react-netlify") which fits perfectly my needs 🙂

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [May 31, 2021, 9:53pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/8 "2021-05-31T21:53:02Z")

</div>

**nikivancic**

two points:   
- I switched to my Windows 10 desktop  
- I ditched npm in favor of yarn  
Went pass the point of versioning conflicts without a hiccup

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 1, 2021, 7:58pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/9 "2021-06-01T19:58:44Z")

</div>

**nikivancic**

My next issue is this something that you may not have experienced at the time you wrote this sample:

> “warn The GraphQL query in the non-page component  
> “C:/work/gatsby/gatsby-netlify-okta/src/templates/blog.js” will not be run.  
> Exported queries are only executed for Page components. It’s possible you’re trying to create pages in your gatsby-node.js and that’s failing for some reason.  
>   
> If the failing component(s) is a regular component and not intended to be a page  
> component, you generally want to use a \<staticquery\> ([https://gatsbyjs.org/docs/s…](https://gatsbyjs.org/docs/static-query) "https://gatsbyjs.org/docs/static-query)")  
> instead of exporting a page query.  
>   
> If you’re more experienced with GraphQL, you can also export GraphQL  
> fragments from components and compose the fragments in the Page component  
> query and pass data down into the child component — [https://graphql.org/learn/q…](https://graphql.org/learn/queries/#fragments "https://graphql.org/learn/queries/#fragments")”

I would care to get your opinion on this, Matt, as I am not used to see you sweep dirt under the carpet"

---

<div class="post-metadata">

**Author:** ![JBon32](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@JBon32](https://devforum.okta.com/u/JBon32)\
**Post date:** [January 25, 2022, 1:50pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/10 "2022-01-25T13:50:46Z")

</div>

I was following along your youtube video about this blog. [Build a Secure Blog with React, Gatsby, and Netlify - YouTube](https://www.youtube.com/watch?v=T5a5nmbV_g4) and around @12:10 where you submit the post after linking your github as the backend. I tried to do the same thing, but Im getting a weird error “Failed to persist entry: API\_ERROR: Reference does not exist” I tried researching it and the general consensus was that people had an issue with this is they were apart of a org in github and didnt have the proper access. I checked and my access was correct and completely connected. So im confused to why that error is still persisting. Here’s a link to my repository. [GitHub - Jarumi-Bonner/gatsby-netlify-okta](https://github.com/Jarumi-Bonner/gatsby-netlify-okta)

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [January 25, 2022, 9:02pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/11 "2022-01-25T21:02:19Z")

</div>

Hello nikivancic,

I did not experience this issue when I last updated the post in April 2021. I see you posted your comment in June 2021. Are you sure you’re using the same versions that I did?

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [January 25, 2022, 9:03pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/12 "2022-01-25T21:03:21Z")

</div>

Hello @JBon32,

I did not experience this issue, so I’m not sure. It looks like you’re connecting to a personal repository now. Are you still experiencing the issue? If so, are you using the same versions I used in the tutorial? I can only confirm that things worked with the versions I used.

---

<div class="post-metadata">

**Author:** ![JBon32](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@JBon32](https://devforum.okta.com/u/JBon32)\
**Post date:** [January 28, 2022, 3:45pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/13 "2022-01-28T15:45:05Z")

</div>

Hi @mraible ,

It may be the versions I had to use. I tried following the tutorial using the version displayed on the blog but that didn’t take with my system. So Installed Netilfy plugin without specifying a version. So that might be where my issue is stemming from.

---

<div class="post-metadata">

**Author:** ![rickes](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@rickes](https://devforum.okta.com/u/rickes)\
**Post date:** [February 24, 2022, 7:56pm UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/14 "2022-02-24T19:56:35Z")

</div>

Hey Matt, thanks for the tutorial I’ve been following the video and Okta developer blog post and it’s great! I’ve been able to work through several issues I caused, but I haven’t been able to render the registration page when I click ‘sign up’ only the Gatsby logo renders, along with a dev console message: GET [https://relaxed-murdock-569d4d.netlify.app/account/api/v1/registration/form](https://relaxed-murdock-569d4d.netlify.app/account/api/v1/registration/form) 404  
okta-sign-in.entry.js:52281  
I haven’t been able to figure this one out, I believe I’m using the versions included in the tutorial. Thanks again, I appreciate any advice you have. My repository is:  
[GitHub - richardsavala/react-blog: react blog, uses Netlify CMS, and Okta JAM](https://github.com/richardsavala/react-blog)  
My site is hosted at:  
[https://relaxed-murdock-569d4d.netlify.app/](https://relaxed-murdock-569d4d.netlify.app/)

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [March 12, 2022, 12:42am UTC](https://devforum.okta.com/t/build-a-secure-blog-with-react-gatsby-and-netlify/17216/15 "2022-03-12T00:42:57Z")

</div>

Hello, @rickes. Do you have API Access management as part of your Okta org? If you’re using a developer account, you should.
