Google Oauth一次又一次地要求权限?

时间:2017-05-11 06:21:46

标签: php google-oauth youtube-data-api google-api-php-client

假设我有以下代码

    $state = 1234;
    $client = new \Google_Client();
    $client->setClientId('######');
    $client->stClientSecreet('####3');
    $client->addScope('https://www.googleapis.com/auth/youtube');
    $client->setState($state);
    $client->setAccessType("offline");       // offline access
    $client->setRedirectUri($redirect_uri);
    $client->refreshToken($decoded_refresh);

    $auth_url = $client->createAuthUrl();
    $client->setApprovalPrompt("auto");

    header('Location: '. filter_var($auth_url, FILTER_SANITIZE_URL));

我有refresh token有线下访问权限,当它调用

  

header('Location:'。filter_var($ auth_url,FILTER_SANITIZE_URL));

但它一次又一次地显示consent screen询问用户权限,我在这里犯了什么错误?

1 个答案:

答案 0 :(得分:0)

这是因为您的应用未经审核,请求OAuth开发人员验证转到https://support.google.com/code/contact/oauth_app_verification