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

Support OAuth2 token #61

Open
ruyadorno opened this issue Mar 21, 2023 · 8 comments
Open

Support OAuth2 token #61

ruyadorno opened this issue Mar 21, 2023 · 8 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@ruyadorno
Copy link
Contributor

Feature Description

A Cloud SQL Node.js Connector user should be able to connect to Cloud SQL Admin APIs using a OAuth2 token.

@ruyadorno ruyadorno added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 21, 2023
@ruyadorno ruyadorno added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Mar 21, 2023
@ruyadorno ruyadorno added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Apr 18, 2023
@joehan
Copy link

joehan commented Mar 8, 2024

Googler here - https://github.com/firebase/firebase-tools/ is looking to use this connector for some upcoming features, and this would be a extremely helpful feature for us (since most of our users use OAuth2).

@jackwotherspoon jackwotherspoon added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Mar 8, 2024
@jackwotherspoon
Copy link
Collaborator

@joehan thanks for the comment! Will bump priority in that case to move this up the backlog

@enocom
Copy link
Member

enocom commented Mar 8, 2024

@joehan This issue might be lacking some details. We recently added support for specifying a GoogleAuth value in #238 with an example usage in the README.

I assume GoogleAuth doesn't satisfy the requirement here? Are you looking for a full OAuth2 flow, or just a way to pass in an OAuth2 token like the Cloud SQL Proxy supports?

@joehan
Copy link

joehan commented Mar 8, 2024

@enocom - we just need a way to pass in a OAuth2 token, since firebase-tools already implements a full OAuth2 flow. Is there an easy way to do this with the GoogleAuth library that I missed?

@enocom
Copy link
Member

enocom commented Mar 13, 2024

Have you tried something like this? I haven't tested this, and am just following the types, so this might be wrong.

import {JWT} from 'google-auth-library';
import {Connector} from '@google-cloud/cloud-sql-connector';

const jwt = new JWT({});
jwt.fromAPIKey("token goes here");

const connector = new Connector({
  auth: jwt
});

@joehan
Copy link

joehan commented Mar 18, 2024

@enocom That didn't quite work - JWT.fromAPIKey expects a API key, but we have a access token. I spent a fair bit of time playing with google-auth-library, and AFAICT, there isn't a way to go from access token -> AuthClient. This makes sense, as the purpose of the AuthClient is to get access tokens.

We could implement a 'dummy' authclient that just returns the access_token we already have, but a simple way to just pass a access token to the connector would be much cleaner for us.

I'm going to keep hacking around to see if I can get something working, and I'll update here if I do.

@joehan
Copy link

joehan commented Mar 22, 2024

Hey all, we ended up finding a solution that worked for us by implementing our own AuthClient and passing it into the Connector. Feel free to deprioritize this if needed - our current solution is probably a bit more brittle, but definitely does what we need.

@enocom
Copy link
Member

enocom commented Apr 1, 2024

Thanks, @joehan. This is on our list, but below a number of high priority items.

@enocom enocom added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants