Google AdSense Management API, The caller does not have permission

Viewed 16

{ "error": { "code": 403, "message": "The caller does not have permission", "errors": [ { "message": "The caller does not have permission", "domain": "global", "reason": "forbidden" } ], "status": "PERMISSION_DENIED" } }

I searched for this but couldn't find a solution. What does 'permission' mean? Is there a missing parameter?

    $access=LaravelGmail::makeToken();
    $thetoken=$access['access_token'];

    $client=new Client();
    $client->setAuthConfig('C:\xampp\htdocs\my-site\credentials.json');
    $client->setAccessToken($thetoken);


    $service=new Adsense($client);

    $account="accounts/"."{".LaravelGmail::user()."}";
    $params = array('startDate.year' => '2022', 'startDate.month' => '09', 'startDate.day' => '10','endDate.year' => '2022', 'endDate.month' => '09', 'endDate.day' => '19', 'metrics' => 'TOTAL_EARNINGS');

    $ex=$service->accounts_reports->generate($account,$params);
    dd($ex); //var dump
0 Answers
Related