# Metadata in React.js

**URL:** <https://community.auth0.com/t/metadata-in-react-js/114572>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [August 26, 2023, 11:49am UTC](https://community.auth0.com/t/metadata-in-react-js/114572 "2023-08-26T11:49:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bookdrive.lokd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bookdrive.lokd/32/50206_2.png) [@bookdrive.lokd](https://community.auth0.com/u/bookdrive.lokd)\
**Post date:** [August 26, 2023, 11:49am UTC](https://community.auth0.com/t/metadata-in-react-js/114572/1 "2023-08-26T11:49:51Z")

</div>

I’m creating an application in which I want to send a metadata for the user logging in. How to send the metadata using loginWithRedirect() function in React.js. So, what all should I do to store the particular metadata for the user and excess it later when required. Help me with the procedure for react.js and Auth0 integration with sending and fetching of the Metadata.

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [August 30, 2023, 10:30am UTC](https://community.auth0.com/t/metadata-in-react-js/114572/3 "2023-08-30T10:30:23Z")

</div>

Hey there, welcome to Auth0!

You can store user metadata in Auth0 [user](https://auth0.com/docs/manage-users/user-accounts/user-profiles/user-profile-structure) sub-object - user\_metadata and request them when caling the `loginWithRedirect()`.

The `loginWithRedirect()` function serves as a call to the Auth0’s /authorize endpoint ([here](https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-the-authorization-code-flow), under “Authorize user”, you can check the parameters the request may take).

When working with [react](https://auth0.com/docs/quickstart/spa/react/interactive), in the index.js file, there are the authorizationParams (the `/authorize` request parameters) being specified. The relevant to user\_metadata parameter is called “socpe”. Here is a sample code snipped under the index.js file including the user\_metadata scope being requested by react app:

```auto
import React from 'react';
import { createRoot } from 'react-dom/client';
import { Auth0Provider } from '@auth0/auth0-react';
import App from './App';

const root = createRoot(document.getElementById('root'));

root.render(
  <Auth0Provider
    domain="{yourDomain}"
    clientId="{yourClientId}"
    authorizationParams={{
      redirect_uri: window.location.origin,
      audience: "https://{yourDomain}/api/v2/",
      scope: "read:current_user_metadata update:current_user_metadata"
    }}
  >
    <App />
  </Auth0Provider>
);

```

More about calling API with react can be found [here](https://auth0.com/docs/quickstart/spa/react/02-calling-an-api).

Hope this helps - let us know!

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [August 31, 2023, 10:08am UTC](https://community.auth0.com/t/metadata-in-react-js/114572/5 "2023-08-31T10:08:17Z")

</div>

This topic also can be helpful for you - [Is it possible to modify a JWT and re-sign it from server side? - #3 by tyf](https://community.auth0.com/t/is-it-possible-to-modify-a-jwt-and-re-sign-it-from-server-side/107431/3)

---

<div class="post-metadata">

**Author:** ![bookdrive.lokd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bookdrive.lokd/32/50206_2.png) [@bookdrive.lokd](https://community.auth0.com/u/bookdrive.lokd)\
**Post date:** [September 1, 2023, 9:57am UTC](https://community.auth0.com/t/metadata-in-react-js/114572/6 "2023-09-01T09:57:51Z")

</div>

Yes it does. Thank you.

---

<div class="post-metadata">

**Author:** ![bookdrive.lokd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bookdrive.lokd/32/50206_2.png) [@bookdrive.lokd](https://community.auth0.com/u/bookdrive.lokd)\
**Post date:** [September 1, 2023, 10:52am UTC](https://community.auth0.com/t/metadata-in-react-js/114572/7 "2023-09-01T10:52:22Z")

</div>

Kindly help me in this as well.

> [@Verify email with code?](https://community.auth0.com/t/verify-email-with-code/115201):
>
> I want when the user’s signup the email\_verified : false is returned. But i want the user to recieve a verification OTP on their mail, which they will enter on the auth0 page and then i receives the email\_verified = true eveytime when a new user signup. How do I achieve this functionality? I would prefer a detailed process.

---

<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:** [September 15, 2023, 10:53am UTC](https://community.auth0.com/t/metadata-in-react-js/114572/8 "2023-09-15T10:53:09Z")

</div>

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