普通网友 2015-10-20 23:36
浏览 53

gmail api客户端身份验证php

i'm using a guide on gmail site but i don't understand in witch way i can send back the autorization from google to my application :

if i use this code on a guide (https://developers.google.com/gmail/api/quickstart/php ) i need to put inside my application the authcode after i went on a google auth page:

    $authUrl = $client->createAuthUrl();
    header('Location: ' . filter_var($authUrl, FILTER_SANITIZE_URL));
    $accessToken = $client->authenticate(AUTORIZATIONCODE);

and using this sistem the authcode work all time i want (i use this sistem 2 weeks ago and i don't need to relogin)

there is a method to put the auth inside the application with out copy the code using copy/paste? and save this code temporay ( 1 day ? 1 week?)

(i create OAuth 2.0 client ID Credentials on google develope is correct ?)

UPDATE!!!

if you need to create an autorizationcode using just a consent screen you need to this step:

1- create a Web application Credential

2- add in this credential the redirect page

3- and change this line inside page this :

$accessToken = $client->authenticate($_GET['code']);

(the expiration time is 3600 )

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测