How can I hide the client_secret for open source project
See original GitHub issueFor an open source project, is there any way that I can hide the CLIENT_SECRET:
AuthorizationCodeResponseUrl authResponse =
new AuthorizationCodeResponseUrl(fullUrlBuf.toString());
// check for user-denied error
if (authResponse.getError() != null) {
// authorization denied...
} else {
// request access token using authResponse.getCode()...
String code = authResponse.getCode();
GoogleTokenResponse response = new GoogleAuthorizationCodeTokenRequest(HTTP_TRANSPORT,
JSON_FACTORY, CLIENT_ID, CLIENT_SECRET, code, redirectUrl).execute();
String tokenAndExpiresInSeconds = response.getAccessToken() + "," + response.getExpiresInSeconds();
return tokenAndExpiresInSeconds;
}
It is a web application but hosted locally and accessed though localhost. The goal is to let end user to access his own Google Drive Spread Sheet and Fusion table.
If it is not possible to hide it, then:
-
Is it break the Google Agreement: https://developers.google.com/terms/
Developer credentials (such as passwords, keys, and client IDs) are intended to be used by you and identify your API Client. You will keep your credentials confidential and make reasonable efforts to prevent and discourage other API Clients from using your credentials. Developer credentials may not be embedded in open source projects.
-
If it does, is there any alternative API provided by Google to address this issue. I checked the Google Sign-In, but seems it also need the client_secret. I also tried the sample project to access the service though command line, but the sample project itself won’t compile since it is using old version of the client API.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:9 (4 by maintainers)
Top GitHub Comments
For reference Can I really not ship open source with Client ID?
You will need to teach your users to create their own clients.
@igorpisarev, thanks. TIL about PKCE.
No plans to add it. We are trying not to add more features to this library, just fix critical bugs and offer maintenance and support where they are needed.