SAP / gigya-android-sdk

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

Duplicate nonce errors from Gigya.login #23

Closed andersu closed 11 months ago

andersu commented 3 years ago

We have quite some users who have trouble logging in and we see in our logging that a lot of them get Gigya error 403004: Duplicate nonce.

This only happens in our Android app and never in the iOS app, so we think the problem must be in our Android code or the Gigya Android SDK.

To try to reproduce it we have tried to call Gigya.login twice in our code, but this does not trigger the duplicate nonce error. When debugging previously we have seen that we sometimes get two callbacks from Gigya calls. Could there be a retry mechanism within the SDK that is not working properly?

tal-mi commented 3 years ago

Hi,

Our SDK does not contain a retry mechanism. Only for config purposes. And we do not cache requests. To get the duplicate nonce error it would mean that the exact same request was fired. I don't see that happening. But I will check it regardless. Please send me the SDK version where these occurrences happened. In addition, can you specify where you encountered the duplicate callback scenario?

Thanks, Tal.

andersu commented 3 years ago

@tal-mi Sorry for the late response, I missed this reply entirely.

Some of our users still have this problem. We can see the duplicate nonce error code logged from real users in production, but we have not been able to reproduce it ourselves.

Here is one example from our logs from June 30:

Gigya error while logging in: Gigya error: code: 403004, message: Duplicate nonce, callId: 71f5df0b39214ca5a29b24ee339875e1

We are currently using: implementation 'com.github.SAP.gigya-android-sdk:gigya-android-sdk-core:core-v5.1.2'

For the scenarios when I got two callbacks I saw both the onSuccess and the onFailure of a GigyaCallback being called:

fun createGigyaCallback(
    success: (GigyaApiResponse?) -> Unit,
    failure: (GigyaError?) -> Unit
) = object : GigyaCallback<GigyaApiResponse>() {
    override fun onSuccess(response: GigyaApiResponse?) {
        success(response)
    }

    override fun onError(gigyaError: GigyaError?) {
        gigyaError?.logIfError()
        failure(gigyaError)
    }
}

I'm sorry, I no longer remember exactly what call that was.

tal-mi commented 3 years ago

Hi,

The issue is being looked at by our backend team. I will update as soon as more info is available.

tal-mi commented 3 years ago

The issue has been resolved by the backend team. Are you still experiencing it?

jarrettroth-png commented 3 years ago

Has this issue been resolved for previous versions of this SDK as well, or is an update to this SDK required in order to fix this issue? I have version 5.1.3, currently in the field and users are still getting the duplicate nonce error.

tal-mi commented 3 years ago

This error has been handled in our backend. Not related to an SDK version. If you are still experiencing it, please provide additional callIds so I can investigate this further.

ofernandez84 commented 2 years ago

I have this issue with the Swift SDK so must be something general. callId 576ec1959171484ea2f77c000db8d335 0cbd99e99ee0400b941f1835bc5e6d3c 7df2ca6a0f0245478721de701a62a6d7 32e42f88119644ad878acad46d6c31e8 cb905f4c3cb64621808949ea074300cf e768cc32f12147c6be9f87ccecac151a ff3b86f7ad2346cbb6e948b9cbca7d50

tal-mi commented 2 years ago

Seems that you are trying to call login with an existing session (which is expired). Why are you trying to perform this flow? Have you tried calling getAccountInfo before calling the login in order to verify that the session is valid? If it is not valid u should explicitly call log out before.

ofernandez84 commented 2 years ago

Seems that you are trying to call login with an existing session (which is expired). Why are you trying to perform this flow? Have you tried calling getAccountInfo before calling the login in order to verify that the session is valid? If it is not valid u should explicitly call log out before.

I was just calling the login flow like each time the user opens the app.

var gigya = Gigya.sharedInstance()
gigya.initFor(apiKey: xxxx, apiDomain: yyyy)
gigya.login(loginId: userId, password: password) { response in... 

This only got solved after uninstalling the app and installing it again. Is there a flow I'm missing? Am I doing anything wrong?

HDBAGORIAR commented 2 years ago

I too experience the same issue in latest gigya ios sdk.

This issue arise after the user reset the password. And even after launching the application again we are getting the same error until we delete the application and reinstall the new one.

gigya.initFor(apiKey: xxxx, apiDomain: yyyy) is called every time user launches the application. So, even if the user relaunches the application the error is same.

Please let us know the fixes

idee24 commented 1 year ago

What I did to work when I encountered this issue was to call the gigya logout function, which clears the session. And after a successful logout, I attempt login again and it worked.

tal-mi commented 11 months ago

Duplicate nonce issues are derived from backend changes. The mobile SDKS do not issue the same nonce to the server. If this still persists, please open a [support case](Via SAP standard support) and we will make sure it is directed to the correct team.