I'm developing a Wordpress plugin that talks to the Google Calendar API through a Google Service Account.
Such a service account comes with a JSON file, which holds its OAuth2 credentials (client_id
, public key
& private key
for example).
For the plugin to work for others, I need them to upload their own JSON credentials file within the plugin. This way the plugin will be able to talk to the Google API and access/modify their personal calendars.
Here's the thing:
Wordpress plugin files have no protection, they are publicly accessible. How do I store a JSON file within a plugin, without exposing the credentials it contains?
"Hey man, you can save JSON in the database..."
I know, but Google's API client requires a string to the credential file, instead of straight JSON:
$client = new Google\Client();
$client->setAuthConfig('./credentials.json');