@@ -22,6 +22,8 @@ export type GoogleStrategyOptions = {
22
22
accessType ?: 'online' | 'offline' ;
23
23
includeGrantedScopes ?: boolean ;
24
24
prompt ?: 'none' | 'consent' | 'select_account' ;
25
+ hd ?: string ;
26
+ loginHint ?: string
25
27
} ;
26
28
27
29
export type GoogleProfile = {
@@ -71,6 +73,10 @@ export class GoogleStrategy<User> extends OAuth2Strategy<
71
73
72
74
private readonly includeGrantedScopes : boolean ;
73
75
76
+ private readonly hd ?: string
77
+
78
+ private readonly loginHint ?: string
79
+
74
80
private readonly userInfoURL =
75
81
'https://www.googleapis.com/oauth2/v3/userinfo' ;
76
82
@@ -83,6 +89,8 @@ export class GoogleStrategy<User> extends OAuth2Strategy<
83
89
accessType,
84
90
includeGrantedScopes,
85
91
prompt,
92
+ hd,
93
+ loginHint,
86
94
} : GoogleStrategyOptions ,
87
95
verify : StrategyVerifyCallback <
88
96
User ,
@@ -104,6 +112,8 @@ export class GoogleStrategy<User> extends OAuth2Strategy<
104
112
this . accessType = accessType ?? 'online' ;
105
113
this . includeGrantedScopes = includeGrantedScopes ?? false ;
106
114
this . prompt = prompt ;
115
+ this . hd = hd ;
116
+ this . loginHint = loginHint ;
107
117
}
108
118
109
119
protected authorizationParams ( ) : URLSearchParams {
@@ -115,6 +125,12 @@ export class GoogleStrategy<User> extends OAuth2Strategy<
115
125
if ( this . prompt ) {
116
126
params . set ( 'prompt' , this . prompt ) ;
117
127
}
128
+ if ( this . hd ) {
129
+ params . set ( 'hd' , this . hd )
130
+ }
131
+ if ( this . loginHint ) {
132
+ params . set ( 'login_hint' , this . loginHint )
133
+ }
118
134
return params ;
119
135
}
120
136
0 commit comments