我正在尝试创建一个基于Web的电子邮件客户端,它可以从google mail API获取所有电子邮件数据.我正在使用Slim3来创建一个宁静的API接口.要访问Google API,我使用的是Google-API-PHP-Client(Google确实有其他API访问权限,我真的很喜欢它但是我仍然没有弄清楚如果不使用PHP-client-library,授权将如何工作).
我的主要问题是如何构建身份验证的一部分,因为谷歌使用Oauth2进行登录,从而提供代码.我可以在Slim中使用基于令牌的简单身份验证,但是我如何实现以下功能:
我如何构建API?
一种方法是使用谷歌的令牌作为应用程序中唯一的令牌 - 但它每小时都在不断变化,所以如何从令牌中识别用户 - 为每个来电呼叫谷歌API似乎不是一个优雅的解决方案.
任何线索/链接都会非常有用.
提前致谢
我正在使用hubot和hubot-fb适配器开发一个Facebook Messenger机器人。所有基本设置均已完成且工作正常。但是,为了与机器人聊天,我需要在所有命令中添加hubot。如果是Facebook聊天,这没有什么意义。当前聊天看起来像这样:
user: hubot ping
bot: PONG
user: hubot the rules
bot: 0. A robot may not harm humanity, or, by inaction, allow humanity to come to harm.
1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
2. A robot must obey any orders given to it by human beings, except where such orders would conflict with the First Law.
3. A robot must p
Run Code Online (Sandbox Code Playgroud)
但是,我希望我的机器人可以在不使用“ hubot”所有消息的情况下进行访问。我该如何实现?
TIA