简体   繁体   English

Google PHP API OAuth 2.0返回URI

[英]Google php api oauth 2.0 return uri

I'm trying to retrieve the email address of clients for a social login to my sites DB. 我正在尝试检索客户端的电子邮件地址,以便对我的网站数据库进行社交登录。

Implementation of the google+ quick-start app for PHP also includes some javascript which breaks IE8 and 9. 用于PHP的google +快速入门应用的实现还包括一些会破坏IE8和9的JavaScript。

So I figured I'd look at a purely PHP API, and downloaded this from git-hub: https://github.com/google/google-api-php-client 所以我想我会看一个纯粹的PHP API,然后从git-hub下载: https : //github.com/google/google-api-php-client

I think I can feel my way using the example files to setting up the call for info I want, but have no idea how to get the result via the return uri. 我想我可以使用示例文件来设置我想要的信息的调用方式,但是不知道如何通过return uri获得结果。 Infact when i run the examples, it logs in fine, and then calls the return uri of which when run doesn't contain any POST data, so I assume it uses some other method. 实际上,当我运行示例时,它会很好地登录,然后调用return uri,当运行时它不包含任何POST数据,因此我假设它使用其他方法。 I've google searched for a while now and no luck. 我已经谷歌搜索了一段时间,没有运气。

Does anyone have any examples, or point to any tutorials, or am I going down the wrong track? 有没有人有任何示例,或指向任何教程,或者我走错了路?

Namaste Namaste

The uri redirects to it's self same php file. uri重定向到它自己的同一个php文件。 Use the idtoken.php example to gain the email address for your DB. 使用idtoken.php示例获取数据库的电子邮件地址。

For testing: 供测试用:

Add the full address to your Google Developers Dashboard / Credentials / REDIRECT URIS: http://yoursite.com/google-api-php-client/examples/idtoken.php 完整的地址添加到您的谷歌开发者控制台/凭证/重定向URI: http://yoursite.com/google-api-php-client/examples/idtoken.php

Edit the idtoken.php and fill out your $client_id and $client_secret and $redirect_uri 编辑idtoken.php并填写$client_id$client_secret$redirect_uri

The $redirect_uri being: http://yoursite.com/google-api-php-client/examples/idtoken.php $redirect_uri是:http: http://yoursite.com/google-api-php-client/examples/idtoken.php

You'll see the result directly on the page, work it from there. 您将直接在页面上看到结果,然后从那里开始工作。

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

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