简体   繁体   English

如何使用Google登录身份验证我的应用程序?

[英]How to auth my app with Google LogIn?

I have googled some info but still not undersant exactly how to auth my app with my server side. 我已经在Google上搜索了一些信息,但是仍然不能完全了解如何通过服务器端对我的应用进行身份验证。

I have Google LogIn button, as far as i understand when i click it, i sent request token, then i get back acsess token and can use it to get info from Google API, 我有Google登录按钮,据我了解,单击该按钮后,我发送了请求令牌,然后取回了acsess令牌,可以用它来从Google API获取信息,

but issue is what i should to do to auth the current user with my DB? 但是问题是我应该怎么做才能用数据库验证当前用户? It is ok that i get a acsess from google to use API, but what about my DB, what i should to do next, how i can concatenate it google logIn and my DB? 可以,我可以从Google获得使用API​​的权限,但是我的数据库该怎么办,下一步该怎么做,如何将其连接到Google登录名和我的数据库?

Could anybody help me to understand consept of auth and registration user in my DB with Google LogIn button? 有人可以通过Google登录按钮帮助我了解数据库中身份验证和注册用户的概念吗?

Well the basic concept is the following: 好吧,基本概念如下:

  1. Do the Google Login with the option to request an IdToken 使用带有请求IdToken的选项的Google登录IdToken
  2. Send the IdToken to your server 将IdToken发送到您的服务器
  3. Check if the IdToken is valid by using one of the Google API Client libraries (here is one for Python ) 使用Google API客户端库之一 (此处为Python之一检查IdToken是否有效
  4. After the token is verified you'll receive a payload which includes the userId - you can use this userId to identify the user in your backend. 验证令牌后,您将收到包含userId的有效负载-您可以使用此userId来标识后端中的用户。

Following a picture of the whole procedure described above: 以下是上述整个过程的图片:

使用服务器登录Google

See the corresponding Blog-Post as well. 也请参见相应的Blog-Post

这可能有助于您自己的oauth2服务器http://bshaffer.github.io/oauth2-server-php-docs/cookbook/

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

相关问题 如何检查用户是否已经在 google auth 中登录。 在安卓中 - How to check if user is already login in google auth. in android 如何将Facebook登录和电子邮件注册添加到我的Google Cloud Endpoints App(Java)? - How do I add both Facebook Login and Email registration to my Google Cloud Endpoints App (Java)? 如何包括谷歌登录我的网站 - How to include google login to my website 无法从我的Android应用com.google.android.gms.auth.GoogleAuthException上传到Google驱动器:未知 - cannot upload to google drive from my android app com.google.android.gms.auth.GoogleAuthException: Unknown 我想开源我的Google App Engine Java项目,Eclipse项目中是否有任何身份验证信息? - I want to open source my Google App Engine Java project, is there any auth info in the Eclipse project? 如何使用Java在Google App Engine中创建登录页面? - How to create login page in google app engine using java? Google App Engine。 如何自定义登录页面? - Google App Engine. How to customize the login page? 如何在Google App Engine上使用Spring Framework创建表单登录名 - How to create a form login with Spring Framework on Google App Engine 如何在我的应用程序上显示Google点动画? - How to display the Google dot animation on an my app? Google App Engine和存储API身份验证错误 - Google App Engine & Storage API auth error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM