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

Ability to access firebase auth emulator with identitytoolkit #2668

Closed
anuraaga opened this issue Jul 3, 2024 · 1 comment
Closed

Ability to access firebase auth emulator with identitytoolkit #2668

anuraaga opened this issue Jul 3, 2024 · 1 comment
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@anuraaga
Copy link

anuraaga commented Jul 3, 2024

Is your feature request related to a problem? Please describe.

I would like to unit test some code using identitytoolkit to create tenants against the Firebase auth emulator, but currently it doesn't seem to be possible. The emulator exposes identitytoolkit at URLs such as

http://localhost:60304/identitytoolkit.googleapis.com/v2/projects/test/tenants

If I try to initialize identity toolkit with this endpoint,

gcpIdentity, err := identitytoolkit.NewService(ctx, option.WithEndpoint("https://localhost:60304/identitytoolkit.googleapis.com"))

it still sends requests to /v2, not to /identitytoolkit.googleapis.com/v2. This is because any path components from endpoint are stripped all the time.

https://github.com/googleapis/google-api-go-client/blob/main/identitytoolkit/v2/identitytoolkit-gen.go#L6186

// (e.g. /bar/gaz gets stripped out of foo.com/bar/gaz).

Describe the solution you'd like
A clear and concise description of what you want to happen.

I'm not too sure the motivation of stripping paths opaquely since all default endpoints should be valid without stripping, and otherwise the user is providing a value that seems like it should be respected. So the simplest would be to not strip out path from endpoint.

If it's a breaking change, then perhaps an option to force keeping the path.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Natively handling the same env var FIREBASE_AUTH_EMULATOR_HOST as the firebase admin SDK. But as this is generated code, it seems not reasonable to have identitytoolkit-specific logic in it.

Additional context
Add any other context or screenshots about the feature request here.

@anuraaga anuraaga added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 3, 2024
@codyoss
Copy link
Member

codyoss commented Jul 22, 2024

Although this is a little different I think this is similar enough to #2623 which both touch on this behaviour. As of right now I don't think we will be changing this behaviour but will leave the issue open for discussion. If we were to make a change like this more testing would need to take place, which the other issue mentions.

@codyoss codyoss closed this as completed Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or 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

2 participants