简体   繁体   English

需要重定向到Google App电子邮件登录页面,而不是password.js和nodejs中的普通gmail登录

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

I have a nodejs application. 我有一个nodejs应用程序。 In which I setup a google auth2 login system using passport js. 在其中,我使用护照js设置了google auth2登录系统。 I need to authenticate against a google app email id not a normal gmail id. 我需要针对Google应用的电子邮件ID(而不是普通的Gmail ID)进行身份验证。 Authentication is working fine. 身份验证正常。 But it is not redirecting to the google app email login page (google.com/a/domain.com). 但是,它不会重定向到Google应用程序电子邮件登录页面(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). 它重定向到gmail登录页面,然后我可以通过输入完整的电子邮件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. 有什么方法可以重定向到App Engine登录页面,以便我只需要键入用户名。

I got the solution by editing this file 我通过编辑此文件得到了解决方案

node_modules/passport-google-oauth/lib/passport-oauth/strategies/oauth2.js 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'; 我在以下两行以下的第164行中添加了新行:params ['response_type'] ='code'; params['redirect_uri'] = callbackURL; params ['redirect_uri'] = callbackURL;

new line is given below params['hd'] = "domainname.com"; 在params ['hd'] =“ domainname.com”下给出新行;

Now it is redirecting to the domain specific login page 现在,它正在重定向到特定于域的登录页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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