I sent request to url1. url1 will redirect to url2 with cookie. url2 is for authorization. And I get code "302 found", which is correct.
But when url2 redirect back to url1, the cookie lost. This results my request keeping redirect to url2, looping until failed.
Does any one met this kind of problem and know a solution? Thanks in advance.
This is a WKWebView problem. UIWebView will work fine. But somehow, I need to change to use WKWebView.
I already tried many solutions, such as Can I set the cookies to be used by a WKWebView?. These methods could handle the cookie in same domain. My problem is url1 and url2 have different domains. When redirect, the cookie is missing, which made the authorization failed, and resulted in looping between url1 and url2.
Does anybody met this problem and found out a workaround? Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…