-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃殌 Feature: accept optional name
parameter in createMagicURLSession
#6034
Comments
@PratikDev thank you for submitting this feature request, this is something our engineering team is discussing since you've submitted it and we will follow up when we have an appropriate update to provide :) |
Thanks. Waiting for the update馃晲 |
Hey @PratikDev, thanks for the suggestion. The reason you can provide the name when creating an account is because this is part of the CRUD for the The reason why we didn't provide the On top of that, if we did provide as an optional parameter, you would be forced to provide the user name in every session creation otherwise the name would be reset to an empty string which is something that we do allow today. If you want to avoid making two requests I can suggest a few options:
|
Screencast from 08-27-2023 12:06:03 AM.webm
|
hi @eldadfux, It's been two weeks. any update? |
it's been nearly two months. should I close this issue? @eldadfux @tessamero @joeyouss @abnegate |
馃敄 Feature description
The
account.create
method takes 3 required parameters and 1 optional parameter. The 4th one is thename
of the user. But the catch is that no other method related to account creation accepts thisname
parameter. This feature covers this issue. Though the title only mentions thecreateMagicURLSession
, it can be implemented increatePhoneSession
method as well. These endpoints just need to accept one more parameter calledname
which we can pass into the DB馃帳 Pitch
In my use case, I was thinking of giving all my users a default username. And the only sign-in method I was using was Magic URL. So there was no way for me to pass the name on the same payload. The only workaround was to call
account.updateName
after the sign-in completion, which obviously not a good idea, as it'll hit the server twice. It also won't have any single point of failure, which means ifaccount.createMagicURLSession
completes butaccount.updateName
fails for some reason, my system will break.So that's why I think this feature will be a great idea to extend. If we have this feature, appwrite devs can take username inputs as well from their users, while keeping the Magic URL / Phone Session sign-in method
But if we implement this, as a JavaScript developer, I can see an upcoming tiny confusion working with
account.createMagicURLSession
in JS. Currently, this method can take 3 parameters, where the first 2 are required and the last one, theurl
parameter is optional. Currently, it looks like:OR
Now if we add another optional parameter
name
, it'll look like:OR
OR
OR
Now this might become confusing to the developer to think which param should be
undefined
for which case. A possible solution for this is to follow how React handles props in their Functional Components. With an object reference. The idea is to pass one object containing all the necessary parameters, instead of passing multiple parameters.An example might look like:
In this approach, the developer doesn't need to think about what should be
undefined
and what's not. They can just pass the props they want in the object. If they wantname
to beundefined
andurl
to be declared, they can do:For vice-versa:
Following this, we can then easily introduce any new optional parameter (maybe
phoneNumber
) in the future that can be passed to the method.Now to follow this approach, it'll require to change all the functions to this structure (to keep the same structure for all) and also the corresponding docs. Which is surely a headache. Now the Appwrite team will know better which approach should be followed.
And if this feature gets the maintainers' focus, I'm pumped enough to work on this
馃憖 Have you spent some time to check if this issue has been raised before?
馃彚 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: