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

Incorrect user provider being recorded for server api key users #5914

Closed
nirinchev opened this issue Sep 30, 2022 · 3 comments · Fixed by #6696
Closed

Incorrect user provider being recorded for server api key users #5914

nirinchev opened this issue Sep 30, 2022 · 3 comments · Fixed by #6696
Assignees

Comments

@nirinchev
Copy link
Member

nirinchev commented Sep 30, 2022

When we persist the user in the metadata Realm, we use the string representation of the provider but we have the same representations for apiKey and serverApiKey:

IdentityProvider const IdentityProviderUserAPIKey = "api-key";
IdentityProvider const IdentityProviderServerAPIKey = "api-key";

Is this intentional? This has the unpleasant side effect that:

enum_from_provider_type(provider_type_from_enum(AuthProvider::SERVER_API_KEY)) != AuthProvider::SERVER_API_KEY;

And if you log in a user with a server api key credential, their provider will instead be API_KEY.

@sync-by-unito
Copy link

sync-by-unito bot commented Sep 30, 2022

➤ James Stone commented:

The set of supported providers is defined by the server and it doesn't look like it has anything called a "Server API Key", just a generic "API key" (source).

I'm not sure how we ended up with two names for the same thing on the client side, perhaps there are historical naming conventions from stitch for providing a synonym. [~[email protected]] do you know? 

In any case I can confirm that they are the same thing under the hood.

@nirinchev
Copy link
Member Author

Interesting, I guess it doesn't make sense to expose different provider types for new SDKs then. cc @cmelchior if you haven't exposed the server api key credentials yet, you may want to opt for a single api key credential type.

@sync-by-unito
Copy link

sync-by-unito bot commented Sep 30, 2022

➤ Jason Flax commented:

This was how the original Stitch API was designed. I do not recall when the two providers were flattened into one.

@ironage ironage self-assigned this Jun 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants