I am trying to authenticate user with google provider, but I got error when I try to login with Oauth2 method. I pass guest BackendlessUser instance, but got exception JsonUnsupportedObjectError, for BackendlessUser instance, NoSuchMethodError (NoSuchMethodError: Class ‘DateTime’ has no instance method ‘toJson’.)
googleSignInAccount = await _googleSignIn.signIn(); //pass ok
GoogleSignInAuthentication googleSignInAuthentication = await googleSignInAccount.authentication; //pass ok
BackendlessUser be = await Backendless.userService
.loginWithOauth2(
"googleplus",
googleSignInAuthentication.accessToken,
{"email": "email"},
true,
AuthServices.backendlessUser,
)
Hi @Maksym_Khobotin2 is there any news regarding this issue? This is really urgent for us and we can not use functionality which is described as feature. I chose backendless because it has authentication with google but it’s not working.
This is my code, I provide BackendlessUser which is loged in as a guest: BackendlessUser be = await Backendless.userService.loginWithOauth2( "googleplus", googleSignInAuthentication.accessToken, {"email": "email"}, true, AuthServices.backendlessUser, );
But I got error below, BackedlessException:
code:3117
message:“Guest Backendless user not found by specified identity. For conversion existing guest user must be provided.”
I tried to debug your sdk and found that on post request, response is bad request 400.
You can check in my database there is user with that email, and email is identity column.
Am I doing something wrong? Or I didn’t set google provider correctly?
The body of your request looks wrong, when you pass the guest user, the “properties” property is redundant. If you remove it, the conversion and login will be successful. https://monosnap.com/file/m8rglQtq1LoCGSQ7gXCNkhy8Lvj6tK
Please let me know if this helped you with your problem.
Hi @Inna_Shkolnaya , yes you are right but you or @Maksym_Khobotin2 need to fix it in method Backendless.userService.loginWithOauth2(), because I debug that method and found that bad request.
When I call loginWithOauth2 I need to pass BackendlessUser object as guest user.
I think this takes a lot of time. This conversation started Feb 25, more then 2 months.
I pay you 300$ for service that you advertise on your site, which simply doesn’t work! Look at your app, you mentioned 15 login providers, how many of them doesn’t work? Should I test them all? Will you give me salary as a tester?
Least what you can do is to refund me some funds. This is not bad experience, this is catastrophic user experience! My application depends on authenticated users.
I can understand everything, but you can not advertise something that you don’t provide to clients. Please fix it, or simply remove Google as authentication provider. You are misleading clients.
We are really sorry that you have such a bad experience with this feature and we totally understand your feeling and how it is important for your business!
The issue is reproduced only with Flutter SDK and that ticket BKNDLSS-24682 has the highest priority. It’g going to be fixed as soon as it only possible.
Authentication works now, but I have another issue.
I have configured security roles to have all rights over data, and when I login user as a guest it gets all necessary rights, but when I transfer that guest user to authenticated user, user lose all rights over all tables. Should I configure something more or there is a bug?
If you want this transformed user (dbtower64@gmail.com) to also have retrieve permission, then you need to add permission for all his roles, in this case there are not enough rights for the SocialUser.
Hi @Volodymyr_Ialovyi, could you please check if login method keep authenticated user logged in? Because when I convert guest user to authenticated user, I pass ‘true’ as stay logged in parameter, but when I restart my flutter application, I got message ‘user with that token doesn’t exists, please reloggin user’. So I need to call login method again.