I often run into the tricky situation that the web content executes critical code before I am able to manually attach the Safari Web Inspector. I came up with the following trick to workaround this issue. The best is that the solution can be used even if you use a library that determines the original URL and passes it to ASWebAuthenticationSession without you having programmatic access to ASWebAuthenticationSession