In the official docs for the Google API and OAuth, it has you download a .json file that includes things like clientid, secret, redirect etc. Then it has you build your Google Client like this (I'm using PHP and offline access to interface with the Youtube API):
$client = new Google_Client();
$client->setAuthConfig('client_secrets.json');
$client->setAccessType("offline"); // offline access
However, I've seen examples that allow you to define this information within PHP and set them on the object individually, instead of via the setAuthConfig .json file inclusion. In my case, that's what I want to do so I can have better control over my redirect url and allow storage of my clientid and secret within my settings forms/database. The examples I've seen look like this:
$client = new Google_Client();
$client->setClientId($clientid);
$client->setClientSecret($secret);
$client->setAccessType("offline");
$client->setRedirectUri($redirect);
Are both of these methods valid ways to define the Oauth Google Client in the current (v3) Google API and Oauth?