# Ngrok “403: Forbidden”

**URL:** <https://community.auth0.com/t/ngrok-403-forbidden/92758>\
**Category:** Get Help\
**Tags:** api, rules, login\
**Created:** [October 19, 2022, 10:39pm UTC](https://community.auth0.com/t/ngrok-403-forbidden/92758 "2022-10-19T22:39:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdnssebastian](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mdnssebastian/32/34333_2.png) [@mdnssebastian](https://community.auth0.com/u/mdnssebastian)\
**Post date:** [October 19, 2022, 10:39pm UTC](https://community.auth0.com/t/ngrok-403-forbidden/92758/1 "2022-10-19T22:39:55Z")

</div>

Hi,

Related:

> [@403 error when i am trying to perform a POST method](https://community.auth0.com/t/403-error-when-i-am-trying-to-perform-a-post-method/84079):
>
> Continuing the discussion from [Receiving 403 Forbidden from .well-known/jwks.json endpoint](https://community.auth0.com/t/receiving-403-forbidden-from-well-known-jwks-json-endpoint/44881): I received below 403 error when I performed POST action. front end angular: [image] backend [asp.net](http://asp.net) 3.1 rules: Roles: Payload: [image] Controller: please could you tell me what is the problem.

> [@"403: Forbidden" returned by /oauth/token](https://community.auth0.com/t/403-forbidden-returned-by-oauth-token/75568):
>
> I’m using the right credentials as far as I can tell, but /oauth/token is returning 403. Anyone know how to troubleshoot this? I’m following the instructions at Here’s what Cypress reports (secrets redacted with “xxx”): The request we sent was: Method: POST URL: [https://dev-rr9aqzra.us.auth0.com/oauth/token](https://dev-rr9aqzra.us.auth0.com/oauth/token) Headers: { “Connection”: “keep-alive”, “user-agent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36”, “ac…

> [@403 Client Error: Forbidden for url {domain}/oauth/token](https://community.auth0.com/t/403-client-error-forbidden-for-url-domain-oauth-token/55798):
>
> Hello! I am working with a django website that has just entered production via heroku hosting. After going into production I had to update Client ID and Secret for the google-oauth connection. Upon doing so, my login seemed to break. Here is some additional info: It works fine when hosted locally It worked fine on heroku before adding the production Client ID/Secret from google When I go to /login/auth0 it begins a redirect loop due to not being able to get to /oauth/token. When I hit “retry…

Following [this](https://www.prisma.io/blog/fullstack-nextjs-graphql-prisma-3-clxbrcqppv) tutorial, after setting up ngrok locally:

```auto
ngrok by @inconshreveable (Ctrl+C to quit)

Session Status online
Session Expires 1 hour, 51 minutes
Version 2.3.40
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http:// ****-**** -a61-11ba-6201-51f8-25ff-9def-f401.ngrok.io -> http://localhost:3000
Forwarding https:// ****-**** -a61-11ba-6201-51f8-25ff-9def-f401.ngrok.io -> http://localhost:3000

Connections ttl opn rt1 rt5 p50 p90     
                              0 0 0.00 0.00 0.00 0.00    

```

and setting up a flow:

```auto
const fetch = require('node-fetch')

exports.onExecutePostLogin = async (event, api) => {
    // 1.  
  const SECRET = event.secrets.AUTH0_HOOK_SECRET
  
  // 2.
  if (event.user.app_metadata.localUserCreated) {
    return
  }

  // 3.
  const email = event.user.email

  // 4.
  const request = await fetch('http:// ****-**** -a61-11ba-6201-51f8-25ff-9def-f401.ngrok.io/api/auth/hook', { // "localhost:3000" will be replaced before deploying this Action
    method: 'post',
    body: JSON.stringify({ email, secret: SECRET }),
    headers: { 'Content-Type': 'application/json' },
  })
  const response = await request.json()

  // 5.
  api.user.setAppMetadata('localUserCreated', true)
};

```

and then starting up the app locally and logging in, there seem to be no calls made to ngrok:

The code in the hook:

```auto
import prisma from "../../../lib/prisma";
import type { NextApiRequest, NextApiResponse } from "next";

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
    const { email, secret } = req.body;

    console.log('mail: ' + email)
    console.log('secret: ' + secret)

    if (req.method !== 'POST') {
        return res.status(403).json({ message: 'Method not allowed' });
    }

    if (secret !== process.env.AUTH0_HOOK_SECRET) {
        return res.status(403).json({ message: `You must provide the secret 🤫` });
    }
    // 3
    if (email) {
        // 4
        console.log('creating user: ' + email)
        await prisma.user.create({
            data: { email },
        });
        return res.status(200).json({
            message: `User with email: ${email} has been created successfully!`,
        });
    }
}

export default handler;

```

Otherwise, the login works:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/4/0/408f8f657a3555cc4cd1e702b33b150cba34e0c1.jpeg)

the image is not displayed in an incognito tab but the user object does contain both the email and the link to the image profile.

Tried calling the endpoint with curl:

```auto

$ curl -X POST -H "Content-Type: application/json" -d '{"email": "sebi@gmail.com", "secret": "top"}' https:// ****-**** -a61-11ba-6201-51f8-25ff-9def-f401.ngrok.io/api/auth/hook
{"message":"You must provide the secret 🤫"}

$ curl -X POST -H "Content-Type: application/json" -d '{"email": "sebi@gmail.com", "secret": "top"}' http:// ****-**** -a61-11ba-6201-51f8-25ff-9def-f401.ngrok.io/api/auth/hook
{"message":"You must provide the secret 🤫"}

```

ngrok endpoints are reachable regardless of protocol (http(s)).

---

<div class="post-metadata">

**Author:** ![MamieR958](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mamier958/32/33313_2.png) [@MamieR958](https://community.auth0.com/u/MamieR958)\
**Post date:** [October 20, 2022, 3:47pm UTC](https://community.auth0.com/t/ngrok-403-forbidden/92758/2 "2022-10-20T15:47:49Z")

</div>

I have exactly the same problem.  
[mygiftcardsite visa](https://www.mygiftcardsite.ltd/)

---

<div class="post-metadata">

**Author:** ![mdnssebastian](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mdnssebastian/32/34333_2.png) [@mdnssebastian](https://community.auth0.com/u/mdnssebastian)\
**Post date:** [October 20, 2022, 4:49pm UTC](https://community.auth0.com/t/ngrok-403-forbidden/92758/3 "2022-10-20T16:49:16Z")

</div>

Fixed it; process.env was not reading the stuff from .env

try to make a POST via curl

---

<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:** [July 26, 2024, 12:53am UTC](https://community.auth0.com/t/ngrok-403-forbidden/92758/4 "2024-07-26T00:53:53Z")

</div>

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