Closed thedmd closed 10 years ago
If accessToken is expired, the SDK will hold the request, refresh token, then re-play it. Your app and users might not aware of it.
So I should not worry about it and keep token once obtained during first sign in, right?
We have cached the accessToken actually. We don't expose it by now because some guys don't use our signin/signup SDK and would like code them own one using our server API. But I think some improvement could be helpful too:
accessToken
is optional when you call pay
. We'll use cached one if you omit it.I thought it was required. Can I assume SDK will prompt for user/pass when needed? Should I just call pay() method and not worry about presenting user 'register' and 'sign-in' buttons?
It's not so easy to tell when the user/pass is needed. It depends on some circumstances such as payment way. Sometimes payment could be finished without signing in. Please give me some time to figure out whether it is practical.
Right now, on my side I have AlertDialog asking user to use current account.
If user choose to sign out this dialog will appear:
Just before invoking payment app will ask to confirm purchase:
I tried to be as informative as possible to avoid confusion from user.
Now, when I know accessToken is not required I'm not sure how to proceed. If SDK provide login window I will just remove those displayed by me and relay on your library to handle authentication.
I just tested payment with authorization dialogs disabled and it failed with response: "message":"user is null","status":400}. It appears user has to be signed in anyway. If accessToken is cached after first call to pay() method is isn't really useful, because signing must be done anyway and retaining token isn't any problem after all.
Sorry, the feature you demand is not pushed to this repo. Please sign in explicitly for the present. We will change the implementation soon and which won't break your codes.
OK, I will keep my dialogs then.
@thedmd We just submit version 0.9.1. There're some big changes. Now you don't need to care about user authentication any more. You could call payment API without checking user authentication first. We'll let users sign in if necessary after they choose a payment way. Refresh the token in SDK if they expire.
Thank you for an update. I will look at changes and update update our code to match changes.
How can I tell if accessToken is expired and user should go trough login process again?