We know that some websites are authenticated by the Basic Authentication of Copper Drum even HTTP. For example, api.fanhou.com
During Air beta2, an air client for food was collected and can run normally. However, after I upgraded to beta3 yesterday, it failed to run normally. The error is as follows:
Urlr. setlogincredentials (loginname, loginpass); this method cannot be found.
This method is removed after the new doc document is queried and the upgrade is confirmed. The question is how to find a new solution, so I searched for some HTTP Authentication principles on the Internet, as shown below:
Basic authentication is the earliest and most compatible scheme specified in HTTP. Unfortunately, it is also the most insecure scheme because it transmits the user name and password with an explicit code. It requires a usernamepasswordcredentials instance. You can specify the access space on the server or use the default logon information.
But what should I do next? Does air provide a new API to replace this method. So I found a static method in the urlrequestdefaults class in the API.
Setlogincredentialsforhost |
() |
So I tried to change the error method:
Urlrequestdefaults. setlogincredentialsforhost ("api.fanfou.com", loginname, loginpass );
Compiled successfully and runs normally.