# Is is possible to set user metadata while signup with google?

**URL:** <https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241>\
**Category:** Get Help\
**Tags:** user\_metadata, google-signup, auth0\
**Created:** [December 30, 2022, 12:59pm UTC](https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241 "2022-12-30T12:59:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev.mubasshirwriter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dev.mubasshirwriter/32/34321_2.png) [@dev.mubasshirwriter](https://community.auth0.com/u/dev.mubasshirwriter)\
**Post date:** [December 30, 2022, 12:59pm UTC](https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241/1 "2022-12-30T12:59:15Z")

</div>

I am using Auth.js v9 method to signup with google but I am unable to pass user metadata in options

```auto
auth.authorize({
            connection: 'google-oauth2',
            redirectUri: process.env.REACT_APP_AUTH0_COACH_REDIRECT_URL,
            responseType: process.env.REACT_APP_AUTH0_RESPONSE_TYPE,
            metaData:{role:'admin'} // gives error at this line it can't be pass here 
        })

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [January 6, 2023, 12:26am UTC](https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241/3 "2023-01-06T00:26:49Z")

</div>

Hello @dev.mubasshirwriter welcome to the community!

Sorry for the delayed response - Were you able to get this sorted?

You might want to look into using Actions to add user metadata and/or add a role to a user. Because you are using a social connection, only the [post login action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow) is available.

> [@How do I add a default role to a new user on first login?](https://community.auth0.com/t/how-do-i-add-a-default-role-to-a-new-user-on-first-login/25857):
>
> Question: How do I assign a default role to a new user on first login? Answer: If you are using the Authorization Core, you can leverage the Management API in a rule to assign a role based on login count. Example Rule: function (user, context, callback) { const count = context.stats && context.stats.loginsCount ? context.stats.loginsCount : 0; if (count \> 1) { return callback(null, user, context); } const ManagementClient = require('auth0@2.27.0').ManagementClient; …

> **[Manage User Metadata with the post-login Action Trigger](https://auth0.com/docs/manage-users/user-accounts/metadata/manage-user-metadata)**
>
> Learn how to use the post-login Action trigger to modify user\_metadata and app\_metadata as part of a user’s login flow.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![dev.mubasshirwriter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dev.mubasshirwriter/32/34321_2.png) [@dev.mubasshirwriter](https://community.auth0.com/u/dev.mubasshirwriter)\
**Post date:** [January 6, 2023, 1:29pm UTC](https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241/4 "2023-01-06T13:29:56Z")

</div>

I have created action to add user metadata to profile and I can pass metadata as an option to the signup method with this approach

```auto
 auth.redirect.signupAndLogin(
            {
                email: email,
                password: password,
                connection: process.env.REACT_APP_AUTH0_DB_CONNECTION,
                redirectUri: process.env.REACT_APP_REDIRECT_URI,
                responseType: process.env.REACT_APP_AUTH0_RESPONSE_TYPE,
                userMetadata: {
                   role: 'admin',
                },
            },
            (error: Auth0Error, result: any) => {
                if (error) {
                   console.log(error)
                }
                if (result) {
                    console.log(result)
                }
            }
        )

```

but while signup with google i am unable to pass `userMetadata` as an options

what I want to do is to pass this props `userMetaData` with google singup too

```auto
 auth.authorize({
            connection: 'google-oauth2',
            redirectUri: process.env.REACT_APP_AUTH0_COACH_REDIRECT_URL,
            responseType: process.env.REACT_APP_AUTH0_RESPONSE_TYPE,
            userMetaData: { role: 'admin' },
        })

```

with documentation I couldn’t find any way to do it with `auth.authorize` method

---

<div class="post-metadata">

**Author:** ![ArkasDev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/arkasdev/32/46875_2.png) [@ArkasDev](https://community.auth0.com/u/ArkasDev)\
**Post date:** [May 3, 2023, 4:32pm UTC](https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241/5 "2023-05-03T16:32:41Z")

</div>

Is there any new information on this issue? I have the same problem.

---

<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:** [November 20, 2024, 9:21pm UTC](https://community.auth0.com/t/is-is-possible-to-set-user-metadata-while-signup-with-google/97241/6 "2024-11-20T21:21:29Z")

</div>

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