IMAP请求允许每次

IMAP请求允许每次

本文介绍了谷歌的Oauth IMAP请求允许每次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的一个基于Web的电子邮件服务(它不是一个相当邮件客户端,但它的很多解释)。不过,我从来没有使用OAuth合作在此之前,但它似乎是要走的路,我基础上的。然而,样本code不提供几次签署解决方案,或者我已经错过了。

所以基本上我的问题是,每次我登录,我需要授权再次Gmail的同时,我在哪里见过你这样做一次,以后您只需登录立刻被重新导向回,而无需再次接受其他服务。

编辑:为了澄清,我正在使用OAuth无论是登录和IMAP,这是愚蠢的?不过,我觉得这是因为它看起来怪异同时拥有一个OpenID和OAuth连接到同一个用户,当所有我的应用程序确实是围绕谷歌为中心通过OAuth应用程式IMAP的最佳途径。我认为tungle.me这种方式工作,因为我只需要授权一旦出现,下一次谷歌即时重定向我回去,我想我的应用程序,以这种方式工作。

EDIT2:进一步搜索后好像授权的第一次,然后我应该使用的身份验证,因为英语不是我的第一语言,我虽然他们的意思是一样的。所以,问题的代表,如何我与谷歌的身份验证时,谁已经在重新创建了一个帐户的用户登录,这样我就不用生成新的令牌每一次。


解决方案

  require_once'./oauth/apiClient.php';
require_once'./oauth/contrib/apiPlusService.php';
$客户端=新apiClient();
$客户 - > setApplicationName(姓名);
$客户 - > setScopes(阵列('https://www.googleapis.com/auth/plus.me'));
$客户 - > setApprovalPrompt(自动);

...最后一个可以解决问题,因为默认情况下apiClient套approval_prompt逼

希望这可以帮助别人

I'm currently working on a web-based mail-service (it's not quite a mail-client but it's a lot to explain). However I've never worked with oauth before this but it seems like the way to go, I've based my simple classes on the sampel code. However the sample code doesn't provide the solution on signing in several times, or I've missed it.

So basically my problem is that everytime I log in I need to authorize to gmail again while I've seen other services where you do that once and after that you just sign in and get instantly redirected back without accepting again.

Edit: To clarify, I'm using oauth both for logging in and for IMAP, is this stupid? I though that was the best way as it seem weird to have both an OpenID and oauth connected to the same user when all my app really do is centered around google apps imap via oauth. I think that tungle.me works this way as I only have to authorize once there and the next time google instantly redirects me back, I want my app to work that way.

Edit2: After further searching it seems like authorization is for the first time and then I should use Authentication, as English isn't my first language I though they meant the same thing. So the questions stands, how to I authenticate with google when a user who've already created an account logs in again so that I won't need to generate new tokens every time.

解决方案
require_once './oauth/apiClient.php';
require_once './oauth/contrib/apiPlusService.php';
$client = new apiClient();
$client->setApplicationName("Name");
$client->setScopes(array('https://www.googleapis.com/auth/plus.me'));
$client->setApprovalPrompt (auto);

... the last one solves the problem, since by default apiClient sets approval_prompt to "force"

Hope this helps someone

这篇关于谷歌的Oauth IMAP请求允许每次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 12:31