SAP / gigya-android-sdk

SAP CDC (Gigya) android sdk for mobile
Apache License 2.0
19 stars 13 forks source link

Login/register function params error #21

Closed anavasHiberus closed 3 years ago

anavasHiberus commented 3 years ago

Good morning. I'm facing a issue related to login/register functions in Android (kotlin).

I'm declaring mGigya.login/register(String!, String!, GigyaLoginCallback) as shown in the documentation but I'm receiving a params error as it says there's no definition for mGigya.login/register(String!, String!, nothing!)

mGigya.login(username, password, object : GigyaLoginCallback<GigyaAccount>() { override fun onSuccess(obj: GigyaAccount) { // Success } override fun onError(error: GigyaError) { // Fail } })

Otherway, I've initialized the "mGigya" object as a Gigya.getInstance() as there's no reference about it. Is it right?

Thank for all in advance

tal-mi commented 3 years ago

Hi, If you have initialized the Gigya singleton correctly there is no reason to get that error. You can follow the example project (kotlin) to see how. I would suggest you use the login/register using params map instead to provide more options.

If you still encounter an issue, please attach some code snippets so I can get oriented better with your issue.

Regards, Tal

volodia-chornenkyi-discovery commented 3 years ago

@anavasHiberus @tal-mi this happens if you initialize Gigya with Gigya.getInstance(). Then generated signature will be like you've mentioned. I also had the same confusion when implemented the new lib version a few days ago.

In order to make it work init it like this Gigya.getInstance(GigyaAccount::class.java)

Looking into the library code it should work but seems conversion to Kotlin doesn't work that great.

tal-mi commented 3 years ago

Thank you for the info. I will check that.

Gigya.getInstance(GigyaAccount::class.java) is a way of initializing the SDK using a custom scheme for your account model. This is what we encourage users to do.

The GigyaAccount class is the basic account class aligned to the account schema on your site (without the data and preferences that can be added using a class extension).

Ill try to make sure that this is handled in the next updates.

Thanks,

Tal