pilcrowonpaper/arctic

Google.createAuthorizationURL is missing some options

Closed this issue · 1 comments

Ideally I think it would be nice to be support all optional params for createAuthorizationURL as outlined in Google's official spec. Particularly, being able to configure the prompt param seems important because without it the following occurs:

  • user signs up via google
  • user logs out
  • user clicks either login or sign up via Google
  • user is automatically logged into previous account

TLDR it would be nice to be able to do this:

  const googleUrl = await google.createAuthorizationURL(state, codeVerifier, {
    scopes: ["email", "openid"],
    prompt: ["select_account"]
  });

Instead of this:

  const googleUrl = await google.createAuthorizationURL(state, codeVerifier, {
    scopes: ["email", "openid"],
  });

  let fullUrl = googleUrl.toString();
  fullUrl += `&prompt=select_account`;

Not a huge deal on the devs end but I was confused why this was happening in the first place because I didn't know anything about the prompt param. Maybe something to include in the docs too.

Regardless, super sick library, I love Lucia, you're the goat 👍

We don't Intend to add non-standard options to keep maintenance cost to a minimum. Since the returned object is the standard URL, you can just do this instead:

const googleUrl = await google.createAuthorizationURL(state, codeVerifier, {
    scopes: ["email", "openid"],
});
googleUrl.searchParams.set("prompt", "select_account");