Auth0 Home Blog Docs

Auth0 round int64 in app_metadata

Dear sir/madam,
I think I found a bug in auth0 metadata parsing.
If you put in a int64 number eg 2507871118665596928 in the app_metadata the auth0 code wil round it too 2507871118665597000. The current work around is using a string to store the number.

1 Like

If you go to the user profile in the dashboard, which of the two numbers do you see?

I tried this in my own tenant. It does appear something is going on. This is before and after saving app_metadata:

And from the management API after saving metadata:

  "app_metadata": {
    "uuid": "d56a5887-9578-4d6b-8aa9-84fa7972bddd",
    "an_int64_number": 2507871118665597000
  },
1 Like

Thank you @markd for confirming that i’m not crazy :stuck_out_tongue:
This is exactly what is happening. Also when the rules use this number and add it into an token the rounded number is used.

Thanks @markd for testing this. Just tried this directly on the browser’s console and got the same error:

JSON.parse('{"big_number": 2507871118665596928}').big_number
> 2507871118665597000

The limitation is in JSON.parse() (see https://stackoverflow.com/questions/18755125/node-js-is-there-any-proper-way-to-parse-json-with-large-numbers-long-bigint and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER).
If you need to store these large values, you’ll have to use strings :+1:

2 Likes

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