wordpress谷歌字体_如何在WordPress中使用Google添加一键式登录

本文介绍如何在WordPress网站上实现一键式Google登录功能,为用户提供快捷登录体验,节省时间和避免重复输入凭证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

wordpress谷歌字体

Do you want to add one-click login with Google to your WordPress site? Allowing users to login with their Gmail account saves them time because they wouldn’t have to remember their WordPress username and password. In this article, we will share how to easily add one-click Google login in WordPress.

您是否想将Google的一键式登录添加到您的WordPress网站? 允许用户使用其Gmail帐户登录可以节省他们的时间,因为他们不必记住其WordPress用户名和密码。 在本文中,我们将分享如何在WordPress中轻松添加一键式Google登录。

How to add one-click login with Google in WordPress
为什么要在WordPress中添加一键式Google登录? (Why You Should Add One-Click Google Login in WordPress?)

Most internet users remain logged in to their Google accounts. This allows them to quickly access all Google apps like Gmail, Drive, Docs, Photos, and more without signing in separately for each app.

大多数互联网用户仍然登录到其Google帐户。 这使他们可以快速访问所有Google应用程序,例如Gmail,云端硬盘,文档,照片等,而无需分别为每个应用程序登录。

Having one-click Google login activated on your WordPress login page allows your users to quickly sign-in to your website using their Gmail account. It saves them time, and they wouldn’t have to enter their login credentials each time.

WordPress登录页面上激活一键式Google登录后,用户即可使用其Gmail帐户快速登录到您的网站。 这样可以节省他们的时间,并且不必每次都输入登录凭据。

If your organization uses GSuite for professional business email addresses, then your team members can use your organization’s Google apps accounts for login.

如果您的组织使用GSuite来提供专业的企业电子邮件地址 ,则您的团队成员可以使用您组织的Google Apps帐户进行登录。

If you run a simple WordPress blog, then you might not find this feature useful. However single sign-on feature like one-click Google login is very helpful for any websites that require users to login such as multi-author websites, membership websites, and websites selling online courses.

如果您运行一个简单的WordPress博客 ,那么您可能不会发现此功能有用。 但是,单点登录功能(如一键式Google登录)对于需要用户登录的任何网站(如多作者网站会员网站销售在线课程的网站)非常有帮助。

That being said, let’s take a look on how to easily add one-click login with Google to your WordPress website.

话虽如此,让我们来看看如何轻松地将Google的一键式登录添加到您的WordPress网站。

在WordPress中添加一键式Gmail登录 (Adding One-Click Gmail Login in WordPress)

First thing you need to do is install and activate the Google Apps Login plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并激活Google Apps登录插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to go to Settings » Google Apps Login page in your WordPress admin area. Under the Main Setup tab, you’ll need to add Client ID and Client Secret code.

激活后,您需要转到WordPress管理区域中的“设置”»“ Google Apps登录”页面。 在“ 主要设置”标签下,您需要添加客户端ID客户端密码。

Apps login settings page

To get these details, you need to visit Google Developers Console. If you are not already logged in, then you will be asked to login with your Google account.

要获取这些详细信息,您需要访问Google Developers Console 。 如果您尚未登录,则将要求您使用您的Google帐户登录。

Next, you need to click on Start a project from the top menu. It will open a popup where you would click on New Project button to continue.

接下来,您需要从顶部菜单中单击“ 启动项目 ”。 它将打开一个弹出窗口,您可以在其中单击“ 新建项目”按钮继续。

New project

Now, you need to add a project name and select the location. Project name can be anything, and Location will be your organization’s domain name (example.com). If you are logged in with your company’s Google account or your GSuite account, then it will add the location and organization automatically.

现在,您需要添加一个项目名称并选择位置。 项目名称可以是任何名称,而“ 位置”则是您组织的域名(example.com)。 如果您使用公司的Google帐户或GSuite帐户登录,则它将自动添加位置和组织。

Project, location, and organization name

However, if you are creating a project from your personal Google account, then you can leave the location with No Organization selected.

但是,如果您是通过个人Google帐户创建项目的,则可以选择“ 无组织”来保留该位置。

Project name and location

Next, click on the Create button to continue.

接下来,单击“创建”按钮继续。

You’ll now be redirected to APIs & Services dashboard. On this page, you need to click on Credentials from the left menu and go to OAuth consent screen page.

现在,您将被重定向到API和服务仪表板。 在此页面上,您需要单击左侧菜单中的凭据,然后转到OAuth同意屏幕页面。

In the Email Address field, you need to add your email address that you have used to create this project. Also you need to add your website URL in the Homepage URL field and click on the Save button.

在“电子邮件地址”字段中,您需要添加用于创建此项目的电子邮件地址。 另外,您需要在“主页URL”字段中添加网站URL,然后单击“保存”按钮。

OAuth consent screen

After that, it will take you to the Credentials page again. Go ahead and click on the Create Credentials button to select OAuth client ID option.

之后,它将带您再次进入“凭据”页面。 继续,然后单击“创建凭据”按钮以选择OAuth客户端ID选项。

OAuth client ID

Next, you need to select Web application as an Application type. In the Authorised JavaScript origins field, you need to enter your website URL (http://www.example.com), and add WordPress login page URL (http://www.example.com/wp-login.php) in the Authorised redirect URLs field.

接下来,您需要选择Web应用程序作为应用程序类型。 在“授权JavaScript来源”字段中,您需要输入网站URL(http://www.example.com),并在以下位置添加WordPress登录页面URL(http://www.example.com/wp-login.php)。授权重定向网址字段。

Web application type

After that click on the Create button, and you’ll see your Client ID and Client Secret information in a popup.

之后,单击创建按钮,您将在弹出窗口中看到您的客户端ID和客户端密钥信息。

Client ID and Client secret

You need to copy and paste these keys on the plugin’s settings page in your WordPress admin area.

您需要将这些密钥复制并粘贴到WordPress管理区域中插件的设置页面上。

Add client ID and client secret in WordPress

After that, you can simply logout from your WordPress admin account, and you’ll see a Login with Google button on your login screen.

之后,您可以简单地从WordPress管理员帐户注销,然后在登录屏幕上看到“ 使用Google登录”按钮。

Login with Google

Clicking on the button allows you to login with one-click into your WordPress account. However, keep in mind that users can only login with the Google account address that they have used on your website.

单击该按钮可以一键登录到WordPress帐户。 但是请记住,用户只能使用他们在您的网站上使用的Google帐户地址登录。

We hope this article helped you learn how to add one-click login with Google in WordPress. You may also want to see our guide on how to create a login popup modal in WordPress, and how to create a custom user registration form in WordPress.

我们希望本文能帮助您学习如何在WordPress中添加Google一键式登录。 您可能还希望查看有关如何在WordPress中创建登录弹出模式以及如何 在WordPress 中创建自定义用户注册表单的指南

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-add-one-click-login-with-google-in-wordpress/

wordpress谷歌字体

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值