简体   繁体   中英

Need to redirect to google app email login page instead of normal gmail login in passportjs and nodejs

I have a nodejs application. In which I setup a google auth2 login system using passport js. I need to authenticate against a google app email id not a normal gmail id. Authentication is working fine. But it is not redirecting to the google app email login page (google.com/a/domain.com). It redirect to the gmail login page and from there I can login and authenticate by typing the full email id (username@domain.com). Is there any way to redirect to app engine login page so that I have only needed to type the username only.

I got the solution by editing this file

node_modules/passport-google-oauth/lib/passport-oauth/strategies/oauth2.js

I added a new line in line 164 below the following 2 lines params['response_type'] = 'code'; params['redirect_uri'] = callbackURL;

new line is given below params['hd'] = "domainname.com";

Now it is redirecting to the domain specific login page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM