# Post-Login Action: Unable to read metadata

**URL:** <https://community.auth0.com/t/post-login-action-unable-to-read-metadata/80175>\
**Category:** Get Help\
**Tags:** react, login\
**Created:** [March 20, 2022, 12:34am UTC](https://community.auth0.com/t/post-login-action-unable-to-read-metadata/80175 "2022-03-20T00:34:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorkel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lorkel/32/33204_2.png) [@lorkel](https://community.auth0.com/u/lorkel)\
**Post date:** [March 20, 2022, 12:34am UTC](https://community.auth0.com/t/post-login-action-unable-to-read-metadata/80175/1 "2022-03-20T00:34:27Z")

</div>

In the old version of rules I was able to add user/app metadata upon login:

```auto
function (user, context, callback) {
  const namespace = 'https://example.com';
  user.user_metadata = user.user_metadata || {};
  user.app_metadata = user.app_metadata || {};
  context.idToken[namespace + "user_metadata"] = user.user_metadata;
  context.idToken[namespace + "app_metadata"] = user.app_metadata;

  return callback(null, user, context);
}

```

I’m trying to follow the preferred method of using actions, but I’m unable to see anything in my user object. I’m using the `@auth0/auth0-react` library, specifically `useAuth0()` function.

Things I’ve tried:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://example.com;
  api.accessToken.setCustomClaim(`${namespace}/testA`, 'Sample Value');
  api.idToken.setCustomClaim(`${namespace}/testB`, 'Sample Value');
  api.idToken.setCustomClaim(`${namespace}/user_metadata`, event.user.user_metadata);
  api.idToken.setCustomClaim(`${namespace}/user_metadata`, event.user.app_metadata);
};

```

Then I am trying to access it with the following:  
`const { user } = useAuth0();`

But no additional info comes into the user object.

How can I do this with actions? Or do I need to continue to use rules?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 21, 2022, 5:46pm UTC](https://community.auth0.com/t/post-login-action-unable-to-read-metadata/80175/3 "2022-03-21T17:46:55Z")

</div>

Hi @lorkel,

It looks like you are missing a single quote on your namespace string. Could this be the issue?

```javascript
const namespace = 'https://example.com;

```

Should be:

```javascript
const namespace = 'https://example.com';

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [May 25, 2022, 9:21pm UTC](https://community.auth0.com/t/post-login-action-unable-to-read-metadata/80175/4 "2022-05-25T21:21:40Z")

</div>


