Publisher login not working in Webview iOS app

snghnishant
snghnishant edited October 2021 in Kite Publisher
We are working on integrating Kite's Publisher for our app to execute BUY/SELL orders through it. Our app is built using Flutter and we are using the flutter_inappwebview package (https://inappwebview.dev/) which is a popular community package for handling in-app web views inside your app made in flutter. The package is cross-platform compatible and utilises the default respective system webview for Android and iOS. Currently, for Android, we are having no issues in handling the Publisher login, order placement through web view which opens in our app. But for our iOS build when the user tries to log in to the publisher, it asks for credentials and then sends the user to the 2FA page but when they enter the 2FA(TOTP) it sends back to the login page with an error at bottom 'Please complete the login before doing 2FA verification'.

What I have tried so far
- Tried setting the 3rd party cookie option to true as it is set to false by default on iOS, the rest of the options are the same for iOS and Android
- On every URL change I am printing all the cookie store data linked to https://kite.zerodha.com URI which shows nothing at all when trying to log in
- Same code works fine on Android build

  • Chandani
    Hello, i want to integrate kite's publisher in my flutter app. I am trying to add kite-button java script in my code but somehow i am facing some issue. Could you please tell me how you integrated kite publisher and execute buy/sell using inappwebview. If you will share some example code then it will help for me.
    Thank you
  • sujith
    Kite Publisher is built with web browser in mind. You will have to redirect user to your page and initiate the Publisher from js context.
  • snghnishant
    @sujith thanks for the reply but we have moved to offsite order execution flow for buying/selling through kite in the mobile app webview. By doing this the session issue got solved.
  • Ishaan
    @sujith , we are doing exactly the same.
    Opening a webpage in-app-browser and binding orders with kite publisher library and linking the button via kite.link("#custom-button");

    Still it is behaving as reported. On taping on the button it asks for username and password, the goes to totp screen. on entering the correct totp it takes the user back to login screen.

    there is not JS error or any reload recorded. so we are not sure how to make it working.

    -- Thanks
    Ishaan
  • sujith
    sujith edited June 2023
    It is not working because of the new cookie policy by safari which blocks cross domain cookie management in the iframe. You will have to try out offsite order execution.
Sign In or Register to comment.