Gmail API:如何获取访问令牌? [英] Gmail API: How to get access token?
问题描述
我正在测试 Gmail API 。
到目前为止,我完成了以下工作: 在地址栏中,它恰好显示为: http:// localhost / main / gmail_callback?code = MY_CODE 其中 main 是我的控制器和 gmail_callback 到目前为止只是一个空白函数。 它应该是正确的,因为这些是我的设置: 我接下来做什么? 基本上,我错误地接近了。遵循这些说明足以获得令牌: https://developers.google.com/gmail/api/quickstart/php 主要观点是从文件访问命令行,而不是从应用程序。 I am testing the Gmail API. So far I have done the following: So now when I run the file quickstart.php it gives a link. When I open it, it appears an authorization page where I authorize my application to access the Gmail API. Then it redirects to the Redirect URIs that I have declared in the setup (adding the code parameter). In the address bar it appears exactly this: http://localhost/main/gmail_callback?code=MY_CODE Where main is my controller and gmail_callback so far is just a blank function. And it should be correct since these are my settings: What do I do next? Basically I was approaching wrongly. Following these instructions is enough to get the tokens: https://developers.google.com/gmail/api/quickstart/php The main point is to access the file from the command line and not from the app. 这篇关于Gmail API:如何获取访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
Gmail API
。
客户端ID
和客户端密钥
。
PHP设置说明。现在当我运行文件快速入门时。它提供了一个链接。当我打开它时,它会显示一个授权页面,我可以授权我的应用程序访问Gmail API。然后重定向到我在设置中声明的重定向URI(添加代码参数)。
$ b
$ b
http:// localhost
http:// localhost / main / gmail_callback
Gmail API
. Client ID
and the client secret
.
http://localhost
http://localhost/main/gmail_callback