Skip to content

Unclear behaviour of createPhoneSession and createMagicURLSession #641

@Megamannen

Description

@Megamannen

Very unclear on what happens when you provide and ID (since it is required) but the Phone / Email already exists,

if you set the user limit to some low number and someone calls createMagicURLSession() or createPhoneSession(), but their account (match on email or phone respectively) doesn't exist, they will get an error.

createMagicURLSession() code:

https://github.com/appwrite/appwrite/blob/891099c7c3dc1fe86c4e64467f9249651991b603/app/controllers/api/account.php#L920

createPhoneSession() code:

https://github.com/appwrite/appwrite/blob/891099c7c3dc1fe86c4e64467f9249651991b603/app/controllers/api/account.php#L1258

it's impossible to provide the matching [USER_ID]

You don't need to provide a matching user id when just logging in. that user id parameter is only used during account creation. Otherwise, it's ignored.

Originally posted by @stnguyen90 in appwrite/appwrite#6154 (comment)

Proposal: documentation and minor code change

Remove the "required" tag of ID and change it to this:

USER_ID [optional] if provided and the user doesn't exist, it will be created with this ID, else it will get a new Unique ID.
EMAIL/PHONE [required]

Will return error if user limit is reached and email/phone doesn't already exist

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions