iZettle / sdk-ios

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

Cannot login in-app, 403 JSON response in web view #448

Closed vladdeSV closed 8 months ago

vladdeSV commented 8 months ago

Expected Behavior

I expect to be able to log in to the Zettle web-view.

Current Behavior

When I submit my login credentials, I get shown a JSON response:

{"code":403,"message":"HTTP 403 Forbidden"}

However, if I open that forbidden page in Safari directly, the page works perfectly.

https://github.com/iZettle/sdk-ios/assets/7542961/1028def5-8fd2-43ab-bb41-cae89a3d8dd1

Steps to Reproduce

I do not know if there is anything specific other than to open the login window for Zettle.

Context

I've gotten the same error when logging into a test account and a production account. The code for initiating the SDK has been the same since a couple a months ago, and I could log in back then. In-app the website is displayed in Swedish (my language), but when I open it with Safari the page is in English.

Failure Logs

N/A

MBelogorodtsev-IZ commented 8 months ago

Hello @vladdeSV, Thank you for reaching out!

Could you please verify that nothing has changed on the developer portal for the app you're using? Especially make sure that the bundle id is not shared with any other applications and the redirect url has been set up correctly.

vladdeSV commented 8 months ago

Hello @MBelogorodtsev-IZ 👋

From what I can tell, everything is the same as before. This is the current setup:

The bundle id is unique to our app, and has not changed

image

The same id is found on the Zettle page

image

where I also configured the callback to look like this

image

Info.plist has this scheme

image

In out main file TicketingApp.swift, we have this code:

init() {
    DispatchQueue.main.async {
        do {
            let authenticationProvider = try iZettleSDKAuthorization(
                clientID: "<redacted>",
                callbackURL: URL(string: "savea-ticketing-scheme://login.callback")!
            )

            iZettleSDK.shared().start(with: authenticationProvider)
        } catch {
            print("ERROR: Zettle could not be init-ed; \(error)")
            print()
        }
    }
}

I won't post the client id, but I assure you they are exactly the same on the Zettle page as in the code block.

Is there anything I've missed or misconfigured?

MBelogorodtsev-IZ commented 8 months ago

Thank you for screenshots and detailed information! I have looked through all of it and I can see nothing wrong with your iOS integration. I will contact the team owning the login flow and come back to you!

Could you please double check also that there is no other app created in Zettle developer portal that use the se.savea.booking.v3 bundle id? Maybe even on the other Zettle developer account. Because this also could be the possible reason for the behaviour you're experiencing. Thank you in advance!

vladdeSV commented 8 months ago

I checked, and we have only one app in the Zettle developer portal with that bundle id. I am very certain we only have one Zettle developer account, mine. Although I think it's very unlikely, but could someone else have registered a Zettle app with our bundle id?

Thank you for the help so far, and for confirming that our integration in the app seems well :)

MBelogorodtsev-IZ commented 8 months ago

Hello @vladdeSV,

could someone else have registered a Zettle app with our bundle id?

It's highly unlikely I would say.

I got a response from our support team to ask you to create a ticket in the Service desk support portal. They will gather the detailed information about the issue and will escalate it to the specific team so that your issue will be solved as soon as possible.

Sorry that I'm not able to help right here from the SDK developer's perspective but I'm more than sure that the support will help you :)
Closing this issue for now.