question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I hide the client_secret for open source project

See original GitHub issue

For 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:

  1. 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.

  2. 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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
LindaLawtoncommented, Jun 4, 2018

For reference Can I really not ship open source with Client ID?

You will need to teach your users to create their own clients.

0reactions
mattwhisenhuntcommented, Apr 20, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I really not ship open source with Client ID? [closed]
"Install applications" client IDs and secrets aren't really secrets, and Google documentation seems to agree: The process results in a client ID and,...
Read more >
How to hide client_secret in Passport? | by bar5um | Medium
In order to hide client_secret in Passport we need to create a new ... Open Terminal and head in to your project's directory...
Read more >
How can I hide confidential data in my open source project?
The basic idea is that you do NOT check-in confidential values in the code or in the compiled binary. Especially if the project...
Read more >
Hiding Secret Keys in Create-React-App - Pluralsight
The first step is to set up a React app. Open a terminal/shell and run these commands to get a create-react-app project set...
Read more >
Safe storage of app secrets in development in ASP.NET Core
The Secret Manager tool hides implementation details, such as where and how the values are stored. You can use the tool without knowing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found