Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Oauth Installed application authorization code flow with gcloud-node? #678

Closed
tamalsaha opened this issue Jun 18, 2015 · 9 comments
Assignees

Comments

@tamalsaha
Copy link

No description provided.

@jgeewax
Copy link
Contributor

jgeewax commented Jun 18, 2015

I think you're talking about 3LO (where a user gets a screen, and you get an OAuth2 token to use on their behalf, which you refresh from time to time...) right?

If so, we currently don't support that, as we're focused on server-to-server communication using service accounts. Pull-requests would be welcome for this, but we're not seeing a lot of customer demand for this one.

@jgeewax jgeewax added the auth label Jun 18, 2015
@dhermes
Copy link
Contributor

dhermes commented Jun 18, 2015

@jgeewax You can support it easily via grabbing the local token from gcloud login. For deployed applications, we should strongly advise against using anything but service accounts (be they via a file or directly via GCE or GAE).

@jgeewax
Copy link
Contributor

jgeewax commented Jun 18, 2015

@dhermes : I believe we do pull the token from gcloud auth login already... I think this is about prompting the user for authorization (aka, do the work that gcloud auth login does)

@dhermes
Copy link
Contributor

dhermes commented Jun 18, 2015

Gotcher. I would cite the support for 3LO tokens minted via gcloud auth login as sufficient and would mark this as "Fixed" (closed on GH).

@tamalsaha
Copy link
Author

We are dynamically creating new GCP project and want to upload files there. Currently, you can only create new GCP projects using 3LO (service accounts does not work). So, we have no service account associated with those GCP projects. I can use gapi-nodejs-client to work around it.

@jgeewax
Copy link
Contributor

jgeewax commented Jun 19, 2015

That makes sense -- a non-existent project doesn't have a service account that would have access.

That said, I think the only way to make that work is to steal the same code that something like gcloud auth login uses, and at that rate, you might as well run that command ... right?

@dhermes
Copy link
Contributor

dhermes commented Jun 22, 2015

If you don't want to require having the gcloud CLI installed, the GOOGLE_APPLICATION_CREDENTIALS environment variable is used with the "Google Default Credentials". You can pick it up as a secondary fallback.

@stephenplusplus
Copy link
Contributor

If you have the JSON object with client_id, client_secret, etc. for an authorized_user type, you can give that to gcloud:

var gcloud = require('gcloud')({
  credentials: {
    client_id: "1111.apps.googleusercontent.com",
    client_secret: '...',
    refresh_token: '...',
    type: 'authorized_user'
  }
});

@tamalsaha Is there any chance that is what you're looking for?

@stephenplusplus
Copy link
Contributor

@tamalsaha going to close, but please re-open if that doesn't resolve the issue.

sofisl pushed a commit that referenced this issue Nov 17, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 422607515

Source-Link: googleapis/googleapis@ba2ffd6

Source-Link: googleapis/googleapis-gen@73ba4ad
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzNiYTRhZGQyMzlhNjE5ZGE1NjdmZmJkNGU1NzMwZmRkNmRlMDRkMyJ9
sofisl pushed a commit that referenced this issue Jan 10, 2023
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [gts](https://togithub.com/google/gts) | [`^2.0.0` -> `^3.0.0`](https://renovatebot.com/diffs/npm/gts/2.0.2/3.1.0) | [![age](https://badges.renovateapi.com/packages/npm/gts/3.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/gts/3.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/gts/3.1.0/compatibility-slim/2.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/gts/3.1.0/confidence-slim/2.0.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>google/gts</summary>

### [`v3.1.0`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#&#8203;310-httpswwwgithubcomgooglegtscomparev303v310-2021-01-11)

[Compare Source](https://togithub.com/google/gts/compare/v3.0.3...v3.1.0)

##### Features

-   support comments in JSON ([#&#8203;571](https://www.togithub.com/google/gts/issues/571)) ([cb6d2ca](https://www.github.com/google/gts/commit/cb6d2cacb5de7bcc9c8e82dd47e14fc5bf9596a3))

##### Bug Fixes

-   **deps:** update dependency eslint-config-prettier to v7 ([#&#8203;601](https://www.togithub.com/google/gts/issues/601)) ([6e26681](https://www.github.com/google/gts/commit/6e266812da4b90b18e2abead9b2b5a1ca0c6654b))
-   **deps:** upgrade to latest version of meow ([#&#8203;616](https://www.togithub.com/google/gts/issues/616)) ([634bad9](https://www.github.com/google/gts/commit/634bad9bbbdb4d397bba101dc38ab14881172a30))

##### [3.0.3](https://www.github.com/google/gts/compare/v3.0.2...v3.0.3) (2020-12-03)

##### Bug Fixes

-   **deps:** update dependency execa to v5 ([#&#8203;600](https://www.togithub.com/google/gts/issues/600)) ([4e5f1e5](https://www.github.com/google/gts/commit/4e5f1e54facf53588bbb3b025b5240edbd7f3c8a))
-   **deps:** update dependency meow to v8 ([#&#8203;591](https://www.togithub.com/google/gts/issues/591)) ([c7e223e](https://www.github.com/google/gts/commit/c7e223e6a2ff605fabad2f8359a0385033f8de66))

##### [3.0.2](https://www.github.com/google/gts/compare/v3.0.1...v3.0.2) (2020-10-26)

##### Bug Fixes

-   **deps:** loosen ts peer dependency ([#&#8203;589](https://www.togithub.com/google/gts/issues/589)) ([8f1d381](https://www.github.com/google/gts/commit/8f1d381d7b166a510c42786c4a337e81b7222c84))

##### [3.0.1](https://www.github.com/google/gts/compare/v3.0.0...v3.0.1) (2020-10-12)

##### Bug Fixes

-   **rule:** turn off [@&#8203;typescript-eslint/no-var-requires](https://togithub.com/typescript-eslint/no-var-requires) ([#&#8203;578](https://www.togithub.com/google/gts/issues/578)) ([3b37229](https://www.github.com/google/gts/commit/3b37229c45969a3c53af123c69bb749578ee6b0b))

### [`v3.0.3`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#&#8203;303-httpswwwgithubcomgooglegtscomparev302v303-2020-12-03)

[Compare Source](https://togithub.com/google/gts/compare/v3.0.2...v3.0.3)

### [`v3.0.2`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#&#8203;302-httpswwwgithubcomgooglegtscomparev301v302-2020-10-26)

[Compare Source](https://togithub.com/google/gts/compare/v3.0.1...v3.0.2)

### [`v3.0.1`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#&#8203;301-httpswwwgithubcomgooglegtscomparev300v301-2020-10-12)

[Compare Source](https://togithub.com/google/gts/compare/v3.0.0...v3.0.1)

### [`v3.0.0`](https://togithub.com/google/gts/blob/HEAD/CHANGELOG.md#&#8203;300-httpswwwgithubcomgooglegtscomparev202v300-2020-10-08)

[Compare Source](https://togithub.com/google/gts/compare/v2.0.2...v3.0.0)

##### ⚠ BREAKING CHANGES

-   change default `check` to `lint` ([#&#8203;570](https://togithub.com/google/gts/issues/570))
-   **deps:** require TypeScript 4.x ([#&#8203;565](https://togithub.com/google/gts/issues/565))

##### Features

-   Add TypeScript v4 support ([#&#8203;551](https://www.togithub.com/google/gts/issues/551)) ([0883956](https://www.github.com/google/gts/commit/08839565a1d2b4b39d532c9b0b596f01b18856fe))
-   change default `check` to `lint` ([#&#8203;570](https://www.togithub.com/google/gts/issues/570)) ([c527b66](https://www.github.com/google/gts/commit/c527b66be1ef6a78ea14b3d29225a8d7fb7097bd))
-   generate .eslintignore when running init ([#&#8203;521](https://www.togithub.com/google/gts/issues/521)) ([8bce036](https://www.github.com/google/gts/commit/8bce0368767f0c2ad7d0700deb839962bc928d16))

##### Bug Fixes

-   add build/.eslintrc.json to files field ([#&#8203;553](https://www.togithub.com/google/gts/issues/553)) ([3b516ad](https://www.github.com/google/gts/commit/3b516ad5e9f0d58201dde469461db7c6ed1c1b78))
-   **deps:** require TypeScript 4.x ([#&#8203;565](https://www.togithub.com/google/gts/issues/565)) ([cbc5267](https://www.github.com/google/gts/commit/cbc5267579ef24e8c8ceaa2ef794df3ef54ea56a))
-   **deps:** update dependency update-notifier to v5 ([#&#8203;574](https://www.togithub.com/google/gts/issues/574)) ([9a882bf](https://www.github.com/google/gts/commit/9a882bf4ac30ad06e7b91a65ad5721d8e8b41c4b))
-   **deps:** update typescript-eslint monorepo to v2.34.0 ([#&#8203;509](https://www.togithub.com/google/gts/issues/509)) ([998a4ac](https://www.github.com/google/gts/commit/998a4ac9b75c97f04d8e5db37563f32d31652f23))
-   **deps:** update typescript-eslint monorepo to v3 (major) ([#&#8203;528](https://www.togithub.com/google/gts/issues/528)) ([e22e173](https://www.github.com/google/gts/commit/e22e17338db2ddb7eb829c821037c2f4e77ff869))
-   **deps:** update typescript-eslint monorepo to v4 ([#&#8203;556](https://www.togithub.com/google/gts/issues/556)) ([54148df](https://www.github.com/google/gts/commit/54148dfbd8b5f8b36a0f44f901c5db933393a661))
-   better error message for broken tsconfig.json ([#&#8203;501](https://www.togithub.com/google/gts/issues/501)) ([0c17a76](https://www.github.com/google/gts/commit/0c17a76c6650eee1d8abaff11a897a432eeaa65f))
-   prohibit calls for it.only and describe.only ([#&#8203;499](https://www.togithub.com/google/gts/issues/499)) ([071c33c](https://www.github.com/google/gts/commit/071c33ceef0e3765166aaebf6ed4698167ac0f98))

##### [2.0.2](https://www.github.com/google/gts/compare/v2.0.1...v2.0.2) (2020-05-11)

##### Bug Fixes

-   Revert 'update dependency eslint to v7'" ([#&#8203;507](https://www.togithub.com/google/gts/issues/507)) ([0f9950b](https://www.github.com/google/gts/commit/0f9950b273329dbcce5f3cc20864c3dcd076f08c))
-   **deps:** pin release of eslint-typescript ([#&#8203;508](https://www.togithub.com/google/gts/issues/508)) ([bd86b42](https://www.github.com/google/gts/commit/bd86b42e2bb904d3765dee82262e4691a11b9958))
-   **deps:** update dependency eslint to v7 ([#&#8203;504](https://www.togithub.com/google/gts/issues/504)) ([6aee159](https://www.github.com/google/gts/commit/6aee1595d0486ae2c7fd68d16b1b59c4c4015753))

##### [2.0.1](https://www.github.com/google/gts/compare/v2.0.0...v2.0.1) (2020-05-07)

##### Bug Fixes

-   throw an error if running with an unsupported version of nodejs ([#&#8203;493](https://www.togithub.com/google/gts/issues/493)) ([94fdf1e](https://www.github.com/google/gts/commit/94fdf1eaed634aa73c3e44c7a3d9f1325f773b07))
-   **deps:** update dependency meow to v7 ([#&#8203;502](https://www.togithub.com/google/gts/issues/502)) ([cf91cda](https://www.github.com/google/gts/commit/cf91cda1afab25759427511d3c97d0037d61c649))

</details>

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-dlp).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants