Skip to content

Commit

Permalink
Fixed accessType Option Support, to support refresh token for Google (#…
Browse files Browse the repository at this point in the history
…1141)

Co-authored-by: pilcrowOnPaper <[email protected]>
  • Loading branch information
sacarvy and pilcrowonpaper authored Sep 21, 2023
1 parent 39dfeaf commit 371dc99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .auri/$tdvzcehm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "@lucia-auth/oauth"
type: "patch"
---

Fix `config.accessType` in `google()` provider
5 changes: 4 additions & 1 deletion packages/oauth/src/providers/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class GoogleAuth<_Auth extends Auth = Auth> extends OAuth2ProviderAuth<
readonly [url: URL, state: string]
> => {
const scopeConfig = this.config.scope ?? [];
return await createOAuth2AuthorizationUrl(
const [url, state] = await createOAuth2AuthorizationUrl(
"https://accounts.google.com/o/oauth2/v2/auth",
{
clientId: this.config.clientId,
Expand All @@ -51,6 +51,9 @@ export class GoogleAuth<_Auth extends Auth = Auth> extends OAuth2ProviderAuth<
]
}
);
const accessType = this.config.accessType ?? "online"; // ( default ) online
url.searchParams.set("access_type", accessType);
return [url, state];
};

public validateCallback = async (
Expand Down

0 comments on commit 371dc99

Please sign in to comment.