Ability to access firebase auth emulator with identitytoolkit
Closed this issue · 1 comments
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.
google-api-go-client/googleapi/googleapi.go
Line 302 in 711eb91
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.
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.