AppleAuth with Unity

Hi,

I need to integrate the Apple login in my Unity Application, since .NET Backendless SDK don’t have the method Backendless.UserService.setCurrentUser (like JS-SDK), How can I set the user returned by AppleAuth.login in my .NET SDK? in order to get data from backend ?

I already tried:

Backendless.UserService.CurrentUser = await Backendless.CustomService.InvokeAsync(“AppleAuth”, “login”, parms);

But seems it doesn’t work

Hi, @Dario_Castaneda.

.NET-SDK provides a login using OAuth2 using the “Apple” provider. The parameter list contains AsyncCallback where you can set your user.

Please let me know if your problem is resolved.
Regards, Nikita.

Hi Nikita,

I’m using UnitySDK and I can’t see any login method with OAuth2, What method should I use?

@Dario_Castaneda, try using a newer version of the Unity-SDK. You can also try using the current version of the SDK, but you will need to replace the Backendless.dll file in your Unity application with a newer one.

Regards, Nikita.

Thanks,

I found LoginWithOAuth1 and LoginWithOAuth2, But I didn’t find any documentation,

What information must be setted to authProviderCode, fieldsMappings params for Apple Login?

The documentation for this logic for .net has not yet been written.
You can look at the documentation for example for Java, the behavior is identical.
https://backendless.com/docs/android/users_social_logins.html

We apologize for the inconvenience.

Hi Nikita,

I’m usin the LoginWithOAuth2 with providerCode using “apple” as a code,

It’s correct?

Backendless.UserService.LoginWithOAuth2(“apple”, userInfo.idToken, userResponse, callback);

I got “Backendless BackendlessFault. Code: 9058, Message: OAuth2 provider is not found.”

I checked and unfortunately the Apple login in the way that I described is not yet available. So I suggest returning to the login via CustomSerivce.
What error did you get when logging in using the CustomService method?

Regards, Nikita.

Using the CustomService method returns correct data, but, I can’t use the returning user info into SDK, since .NET SDK doesn’t have setCurrentUser or similar, so, I can’t set the logged user, and I can’t do any query to data

You can set the current user in the SDK via the CurrentUser’s property. There is no need for a separate method for this.
You said you already tried this:

This is an alternative to the setCurrentUser() method that you mentioned. If no error arises for you, then what exactly happened?
This code should work:

Backendless.UserService.CurrentUser = await Backendless.CustomService.InvokeAsync<BackendlessUser>( "AppleAuth", "login", /*something values*/ );

I have a couple of Business Logic services which uses the context.userId to track the user activity.

Using CustomService.InvokeAsync and setting the response to set the backendless user with CurrentUser function, returns null value in context.userId (in Business Logic JS function),

Another value setted in context is:

Context:
userRoles: [ ‘DotNetUser’, ‘NotAuthenticatedUser’ ],

I really need the user Id when login is Apple Login and a Business Logic service is invoked.

Context content in Business Logic Service:

I am working on this problem. I’ll let you know when the results are available.

Best regards, Niktia.

Hi Dario,

I have a question about the following:

Could you please split the description above into individual steps to make it clearer where the problem is? Ideally, we’d like to see it in the format of “steps to reproduce”.

Regards,
Mark