Reputation: 8308
I think client_secret.json has very sensible information, I don't like to store it as a plain text on a .json file, but is the example that Google gives you: https://developers.google.com/gmail/api/quickstart/quickstart-java
Where should I store that file?
Upvotes: 3
Views: 1405
Reputation: 8308
After being incapable to read a file on assets or raw folder (really is that difficult? compression, readers everywhere, permission...) I decide to use an StringReader with the file contents on the code and use that reader to create the needed GoogleClientSecrets.
Not so cool, but works and I think this data is pretty unmutable in time so I'm not worry about could be a bit more difficult to maintain.
So code looks like:
Reader r = new StringReader("{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\".... ");
try {
clientSecrets = GoogleClientSecrets.load(jsonFactory, r);
} catch (IOException e) {
e.printStackTrace();
}
Upvotes: 1