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

Account by username #264

Open
ahme-dev opened this issue Jan 1, 2025 · 3 comments
Open

Account by username #264

ahme-dev opened this issue Jan 1, 2025 · 3 comments

Comments

@ahme-dev
Copy link

ahme-dev commented Jan 1, 2025

Is it possible to get an account using the username only, rather than the id?

@cainlevy
Copy link
Member

cainlevy commented Jan 2, 2025

No, currently the GET endpoint only finds by ID

@ahme-dev
Copy link
Author

ahme-dev commented Jan 2, 2025

No, currently the GET endpoint only finds by ID

Is it possible for this to be added as a feature? I could try making a PR for it if I find the time.

At the moment, when we create an auth account, we run a query to store the account id and username on our end, to get the account with later. Somehow the latter query fails sometimes, which essentially locks us out of getting the auth account, since we can't link the username to the account id, and therefore can't get the auth account. If I'm missing some feature or way, I'd appreciate a correction. (we've set the signup endpoint to private so it only functions on the backend)

@cainlevy
Copy link
Member

cainlevy commented Jan 2, 2025

Yes, I think this is possible and would be happy to look at a PR. Perhaps the existing GET endpoint could search both fields in sequence?

It sounds like you're dealing with a two-phase commit problem where your client POSTS an AuthN account but then fails to POST that information to your application. If the user tries to sign up again, they'll get an "already taken" error from AuthN. Is that right?

This can be challenging. One approach you might consider is turning the sign-up process into two steps, where the first step is a find-or-create action to AuthN and the second step collects any additional information you need to save a user profile in your application. This is similar to an OAuth flow, where authentication happens elsewhere and your application must have a separate process for gathering profile information.

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

2 participants