Extracting request body of a POST request from Web View (for SAML authentication)


#1

I’m using a NativeScript webview to authenticate users of the mobile app via SAML. I know that the web view sends the SAML response from the identity provider to the login/callback endpoint of my service provider as an HTTP POST request. I verified this by inspecting the HTTP traffic of my already existing web app in Chrome’s dev tools. I need to capture this request from the webview to extract the details of the user who just logged into the mobile app.

webview.on(WebView.loadStartedEvent, (args: LoadEventData) => {
      if (args.url === <callback_url>) {
        // extract SAML response from args
      }
    });

I have tried to extract the SAML response when the webview tries to load the login callback URL. However, although I can see that the webview is trying to load that URL from args.url as shown above, I cant extract the body of the HTTP request since ‘args’ does not contain that data. Any help is greatly appreciated.

Thanks in advance.