# Hello World Full-Stack Security: React v17/JavaScript + Express.js/JavaScript : Basic Access Control Issue

**URL:** <https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642>\
**Category:** Get Help\
**Tags:** quickstarts-backend-api, sdks-quickstarts\
**Created:** [January 25, 2024, 1:15am UTC](https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642 "2024-01-25T01:15:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![naya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@naya](https://community.auth0.com/u/naya)\
**Post date:** [January 25, 2024, 1:15am UTC](https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642/1 "2024-01-25T01:15:30Z")

</div>

I am new to Auth0 picking up the flow to integrate in the project I am working on. I am currently just trying out sample code that reflects the stack that I feel comfortable to use following guides and instruction to better understand the process. I am running the full stack code sample “Hello World Full-Stack Security: React v17/JavaScript + Express.js/JavaScript” now I am stuck running around the circle jumping from pages to pages, repos to repos where the materials and approaches are different that led me to confusion.  
So, the problem is with sending the access token from SPA to API. The login and logout work fine, including the public page of course. But when it comes to Protected Page where the endpoints are private that validate the access token it is not getting authenticated and just responding with bad credential from API server. I would appreciate it if anyone can please help me out here. Thank you in advance.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 25, 2024, 1:24am UTC](https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642/3 "2024-01-25T01:24:32Z")

</div>

Hello there @naya welcome to the community!

> [@naya](#):
>
> So, the problem is with sending the access token from SPA to API. The login and logout work fine, including the public page of course. But when it comes to Protected Page where the endpoints are private that validate the access token it is not getting authenticated and just responding with bad credential from API server. I would appreciate it if anyone can please help me out here. Thank you in advance.

That’s great that you’re able to log in and out successfully 🙂 In the guide there is a section related to registering an API in Auth0 and obtaining the audience (API Identifier). This `audience` value needs to be including when configuring both your React App and Express server. Are you able to confirm that both `.env` files have the same value listed for `audience`? If you’re able to pull the access token used and decode it at [jwt.io](http://jwt.io) and share(sensitive information redacted) here I’d be happy to take a look.

---

<div class="post-metadata">

**Author:** ![naya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@naya](https://community.auth0.com/u/naya)\
**Post date:** [January 25, 2024, 2:04am UTC](https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642/4 "2024-01-25T02:04:51Z")

</div>

Thank you very much for your kind response @ty.frith  
I would be happy to share of course and yes everything is set up accordingly in .env for the Auth0 Domain, Client ID and Audience etc.  
Here is the JWT that is return when getAccessTokenSilently() is called on the protected-page

> **[JWT.IO](https://jwt.io/#debugger-io?token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImlTcWlCRXRTRHlhMi1zWWV2Zm8xUSJ9.eyJpc3MiOiJodHRwczovL2Rldi1nMG91bWhxZ2t1cGhsZHFrLnVzLmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw2NGU2MmU1N2NjMmE0ZDQ4MDU2NDNmZjAiLCJhdWQiOlsiaHR0cHM6Ly9oZWxsby13b3JsZC5leGFtcGxlLmNvbSIsImh0dHBzOi8vZGV2LWcwb3VtaHFna3VwaGxkcWsudXMuYXV0aDAuY29tL3VzZXJpbmZvIl0sImlhdCI6MTcwNjE0ODA0NywiZXhwIjoxNzA2MjM0NDQ3LCJhenAiOiJUb0gxRmMyajJGOU52ZWpCVThRSFNxOWFXTkxaNm5DRCIsInNjb3BlIjoib3BlbmlkIHByb2ZpbGUgZW1haWwifQ.aM2NjuIl2_OuLRkFw7lDqVEIIVGcbalxAyXR33b15LZUxl0WCjysWFvji_VI54fjoVp0UaUo4b0PHltqH1q0q9Vx-ibKCh6GW9ae-VgIs52S9PIQJ4j5lZbZZBbm85HPjZwigEl5s8HsNVUES6iiVepN2jICARoP-88jVw3qlH-v55titItfao6daAgdYRuA4-9VW_bZC2Xh30HoIEp3XHWE4Qeqk_bWAPnbcUmFgVGHR9FFgnyOXbJzjJCz2Er1fD3K2um5zTj1HKZuoJKfCLKPFqL_kHFy2dKMm9jYudM67s1Ff2vXUHCMQmmyXJVe7GZRXb0CQ7V0qYV9Ju_VLg&publicKey=%7B%0A%20%20%22e%22%3A%20%22AQAB%22%2C%0A%20%20%22kty%22%3A%20%22RSA%22%2C%0A%20%20%22n%22%3A%20%22zVKG1WqOvuBxlGeOZZWLPtHsdRBZ1US55vZMVOeRrrPnBAHx7ixylmAgdcFuMIH9lVhnWFWYqcZb_UW7oqQ1i0JWp4tGf-FbwuxNAn6PmvHPoloYUpPlF1L87P1azMnVct7q4ced4k29F1OYboWSYzgjD9BS0d5ANQVZ_mW6v_TnjztgEj5l7NDvJhPAkm9STNfcTLgFBF22AtRFXDIJJrVulKaPkOEcrZC8IkGdpYF3R7bILf50ABa6762JCWBlD2SyL2aEU2vDCVvQlfRKUloVxBU8P_SumUZo1pzIwaBCeV6mZNViH9o5XCXzNgoTMF3g_NgN6Px1PYFrYzdhAw%22%0A%7D)**
>
> JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 26, 2024, 5:05pm UTC](https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642/5 "2024-01-26T17:05:08Z")

</div>

No problem, happy to help!

Thanks for sharing the JWT - It looks completely valid to me.

I just tested the sample myself and was unable to reproduce the error you’re seeing. Sounds silly, but I might try setting up the sample again from scratch 😕 Aside from that if you want to DM me your `.env` files (or the entire project) I’d be happy to take a look!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 9, 2024, 5:05pm UTC](https://community.auth0.com/t/hello-world-full-stack-security-react-v17-javascript-express-js-javascript-basic-access-control-issue/125642/6 "2024-02-09T17:05:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
