# Need help with protecting public endpoints WITHOUT user authenticating

**URL:** <https://community.auth0.com/t/need-help-with-protecting-public-endpoints-without-user-authenticating/141718>\
**Category:** Dev to Dev Hub\
**Tags:** apis, application\
**Created:** [August 25, 2024, 6:47am UTC](https://community.auth0.com/t/need-help-with-protecting-public-endpoints-without-user-authenticating/141718 "2024-08-25T06:47:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fattynomnom](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fattynomnom/32/48671_2.png) [@fattynomnom](https://community.auth0.com/u/fattynomnom)\
**Post date:** [August 25, 2024, 6:47am UTC](https://community.auth0.com/t/need-help-with-protecting-public-endpoints-without-user-authenticating/141718/1 "2024-08-25T06:47:04Z")

</div>

Hi all! I’ve already setup my backend (Express + GraphQL) and frontend (NextJS) with Auth0, users are able to authenticate using Auth0, and call APIs (protected with Auth0) with the credentials, so I have no issue with this part.

But I need help with “protecting” APIs that are public. I want to have some APIs that my NextJS app will call WITHOUT the user logging in, but at the same time, these APIs should be protected in the sense that it should only be called by my NextJS app.

I have done some research on the official docs, and this is the closest thing I could find: [https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow/call-your-api-using-the-client-credentials-flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow/call-your-api-using-the-client-credentials-flow)

But the article mentions M2M applications, so i guess the best way to go about it is creating a “proxy” API to get/generate client access tokens for my Next app to use? Is this most ideal? But wouldn’t anyone also be able to access this “proxy” API to generate a client token as well?

Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [April 14, 2025, 7:59pm UTC](https://community.auth0.com/t/need-help-with-protecting-public-endpoints-without-user-authenticating/141718/2 "2025-04-14T19:59:20Z")

</div>

Hi @fattynomnom,

Welcome to the Auth0 Community!

Unfortunately as stated in this post, the nature of public APIs makes it hard to protect for use by a specific application.

> [@How to authenticate SPA against API without User login](https://community.auth0.com/t/how-to-authenticate-spa-against-api-without-user-login/33252/3):
>
> @dtl, Welcome to the Auth0 Community Forum! There is not really any solution for this. Due to the nature of public clients, any global API key or secret that is sent with the application is inspectable by any user who can access the SPA. They can get the key/secret and use the API like they were the SPA. You can obfuscate it to make it more difficult for an average user, but a public client with no unique credential (like a username/password) is going to be able to be inspected. Do you have a…

If you have any other questions feel free to reach out.

Have a good one,  
Vlad

---

<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:** [April 29, 2025, 1:35pm UTC](https://community.auth0.com/t/need-help-with-protecting-public-endpoints-without-user-authenticating/141718/4 "2025-04-29T13:35:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [September 5, 2025, 8:38pm UTC](https://community.auth0.com/t/need-help-with-protecting-public-endpoints-without-user-authenticating/141718/5 "2025-09-05T20:38:36Z")

</div>


