# Link Multiple Google Accounts to single user (Next.js)

**URL:** <https://community.auth0.com/t/link-multiple-google-accounts-to-single-user-next-js/89596>\
**Category:** Get Help\
**Created:** [August 29, 2022, 2:52pm UTC](https://community.auth0.com/t/link-multiple-google-accounts-to-single-user-next-js/89596 "2022-08-29T14:52:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asontha](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/asontha/32/33801_2.png) [@asontha](https://community.auth0.com/u/asontha)\
**Post date:** [August 29, 2022, 2:52pm UTC](https://community.auth0.com/t/link-multiple-google-accounts-to-single-user-next-js/89596/1 "2022-08-29T14:52:47Z")

</div>

I’m following this question’s solution:

> [@Account Linking with Next JS and Auth0](https://community.auth0.com/t/account-linking-with-next-js-and-auth0/61922):
>
> Hi In my nextjs application I have a user settings page which has a ‘Link Google’ button. The desired functionality is, users should be able to link their google accounts. That can be with the same email they logged in with or a different email. How can we achieve that ? I am using the nextjs-auth0 package and universal login. Thanks Debabrata Pramanik

In my SPA, a user signs in with Google. I then want them to be able to link another Google account if they have one (I have multiple for example).

I route the user to `/api/auth/login?type=google-oauth2` where I check for type for account linking, and then set `connection` in `authorizationParams` before calling `handleLogin`. It immediately uses the existing google oauth login and routes the user instead of giving them an option to login and link another google account.

Here’s my […auth0.js]

```auto
import { handleAuth, handleLogin, handleLogout } from '@auth0/nextjs-auth0';

export default handleAuth({
  async login(req, res) {

    // Check for account link request.
    if (req.query.type) {
      const authorizationParams = {
        connection: req.query.type
      }
      await handleLogin(req, res, {
        returnTo: "/some-path",
        authorizationParams
      })
    }
    else {
      await handleLogin(req, res, {
        returnTo: "/some-path",
      });
    }

    
  },
  async logout(req, res) {
    await handleLogout(req, res, {
      returnTo: "/",
    });
  },
});

```

How can I force a new Google login?

---

<div class="post-metadata">

**Author:** ![asontha](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/asontha/32/33801_2.png) [@asontha](https://community.auth0.com/u/asontha)\
**Post date:** [August 29, 2022, 3:34pm UTC](https://community.auth0.com/t/link-multiple-google-accounts-to-single-user-next-js/89596/2 "2022-08-29T15:34:14Z")

</div>

I was able to fix this by changing authorizationParams to:

```auto
const authorizationParams = {
        connection: req.query.type,
        prompt: "login"
      }

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 4, 2022, 2:04pm UTC](https://community.auth0.com/t/link-multiple-google-accounts-to-single-user-next-js/89596/3 "2022-11-04T14:04:01Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 4, 2022, 2:04pm UTC](https://community.auth0.com/t/link-multiple-google-accounts-to-single-user-next-js/89596/4 "2022-11-04T14:04:03Z")

</div>


