Auth0 NPM SDK with React APP not working. App not loading

Please include the following information in your post:

  • auth0-node
  • Version: 2.30.0 (auth0) and 2.20.10(@types/auth0)
  • Platform: Node v10.23.0
  • TypeError: Cannot read property ‘native’ of undefined

I am using a react app (React version: 17.0.1 with typescript). I have used a SPA client and integrated the app with auth0 SPA with react-auth0 SDK and it works fine.
Now I want to do some Management OPS from the react app like get user roles, etc.
For that, I can either make API calls to auth0 or use auth0 node SDK.
When I use the above node SDK, I get the error: TypeError: Cannot read property ‘native’ of undefined

Can someone help me figure out what’s the issue?

In the docs here: auth0 - npm, I saw it’s mentioned to set telemetry as false.
I don’t see any option to do so. In the class constructor param options, the typescript isn’t showing telemetry as one of the options.
I also tried setting telemetry as false forcibly in the options using // @ts-ignore. It didn’t work either.

HI @arnabroy1907dev,

You shouldn’t use the node SDK with the management API in a public client (react app) as you describe. This should be done by a trusted backend API. The user could easily grab the management API credentials and make calls themselves.

1 Like

Ok. that makes sense. In that case, I have to move that logic to a node server.

1 Like

Let us know if you have any other questions.

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