Parse anonymous login (Guest user)

794 views Asked by At

I am making a mobile app using Flutter sdk, which requires me to allow a guest user enter into pages wihtout login id. So, I am seeking something like anonymous user login or auto-generate a user with random username. I am using parse_server_sdk.

In the api documentation, I found a function called loginAnonymous() in class ParseUser. But the class constructor itself requires username & password for instantiation.

So, it defeats the purpose of my use-case. Please let me know how to get around this problem.

1

There are 1 answers

0
Maximilian On

Have you tried providing null as the username as well as the password and email? I am not using loginAnonymous(), but this should work:

ParseUser parseUser = ParseUser(null, null, null);
await parseUser.loginAnonymous();

EDIT:

This should work, too.

ParseUser parseUser = ParseUser.forQuery();
await parseUser.loginAnonymous();