iZettle / sdk-ios

Add card payments from Zettle to your own app
https://developer.zettle.com/docs/ios-sdk
Other
83 stars 38 forks source link

Login screen presented on every transaction #65

Closed ls-jamie-hill closed 7 years ago

ls-jamie-hill commented 8 years ago

We are using enforcedUserAccount as recommended in the docs, but we are presented with the login form (email locked) on every transaction. How can we keep the logged in session active so a user is not forced to enter a password with every transaction?

mansbernhardt commented 8 years ago

It should remember.. Are you sure you don't call "invalidateSession" somewhere?

ls-jamie-hill commented 8 years ago

Yes, we're not calling invalidateSession anywhere. Anything else that may cause this?

mansbernhardt commented 8 years ago

Could you verify that this is also a problem on device and not only on the simulator?

ls-jamie-hill commented 8 years ago

Yes, this is with a device. We are not using the simulator.

mansbernhardt commented 8 years ago

Could it be that you wipe any of our data, such as our core data stack? The SDK is also dependent on identifierForVendor to stay the same between launches. Do you have the same problem in our sample app?

ls-jamie-hill commented 8 years ago

No, we wouldn't be wiping any data. I'll give the sample app a try and see if we hit the same issues. Does that use enforcedUserAccount too?

mansbernhardt commented 8 years ago

Might not (something we should update). But you can always mod it.

ls-jamie-hill commented 8 years ago

So after a bit of testing, if I don't use enforcedUserAccount then it works as expected - it prompts the first time for credentials and then doesn't prompt on subsequent. However, if I use enforcedUserAccount then it prompts every time for the password.

Essentially we have a step in our system to request the email to enforce, then we set it in the SSKeychain for subsequent uses:

        [[iZettleSDK shared] setEnforcedUserAccount:email];
        [KPCredentialStorage setiZettleEnforcedUserAccount:email];

then for init:

    NSDictionary *configuration = [[NSBundle mainBundle] infoDictionary];
    [[iZettleSDK shared] startWithAPIKey:configuration[@"iZettleAPIKey"]];
    NSString *enforcedEmail = [KPiZettlePairDevice enforcedUserAccount];
    [[iZettleSDK shared] setEnforcedUserAccount:enforcedEmail];

then we find that it prompts every time for the password for that account on each payment.

mansbernhardt commented 8 years ago

Have you tried with different enforcedEmail users. I'm thinking it might be some string comparison that fails for some reason. What are the account(s) your are using for testing?

Also, for verification, are you running on the latest version of the SDK (1.2.3)

ls-jamie-hill commented 8 years ago

The email being used for enforced email is externaldemo123@izettle.com. That is the only account we have been provided.

We are running the latest 1.2.3 SDK.

mansbernhardt commented 8 years ago

I downloaded the latest SDK and modded the sample app to enforce the user by adding:

[iZettleSDK shared].enforcedUserAccount = @"externaldemo@izettle.com";
[[iZettleSDK shared] chargeAmount:amount  ....

before "chargeAmount:" and it works as expected. Could you try to use the above, i.e. hardcode the enforcedUserAccount value to test if it makes a difference?

mansbernhardt commented 8 years ago

Hi again, did you find a solution to your problem?

ls-jamie-hill commented 8 years ago

The way it works without enforcedUserAccount is suitable for us at this stage. If we revisit then we'll try the updated example and let you know.

Appville commented 5 years ago
When I using enforcedUserAccount In Payment option login screen the password not stored hence, every time the user has to type the password. please let us know why izettle sdk is not storing the password.

password_reenter