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

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

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 
        })

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 is available.

Hope this helps!

1 Like

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

 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

 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

1 Like

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