build() ->setBaseUri('https://'.$conf['instance']); // get user based authorization: // generate authorize url // (we'll reuse the app created above) $authUrl = $client->getAuthorizeUrl( 'code', $conf['client_id'], 'https://admin.piaille.fr/callback.php', 'read write admin:read admin:write', ); // redirect user to this url, where they can log in: echo "URL: ".$authUrl."&state=".$argv[1]."\n";