duanqin9631 2011-05-05 08:22
浏览 15

Google Oauth IMAP每次都要求获得许可

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.

  • 写回答

2条回答 默认 最新

  • douzhicai7148 2011-05-05 08:32
    关注

    Using the google API you can turn a 1 time auth cookie into a permanent auth cookie. If you store this new permanent auth cookie in a database or somewhere, you can use it for that specific user instead of generating a new auth cookie each time.

    Something like this:

    $client = new Zend_Gdata_HttpClient();
    $client->setAuthSubPrivateKeyFile('key.pem', null,false);
    $uri = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session)
    $gCalToken = Zend_Gdata_AuthSub::getAuthSubSessionToken(trim($uri),$client);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题