1
これらはhttpヘッダーと認証を持つAlmofireを使用してhttp投稿リクエストを送信するにはどうすればいいですか?
1.parameters URLCredential
let user = "user1" let password = "password1"
4.URL
とlet parameters: Parameters = ["username ": "Henry","password":"xxxx","key"="ewq2356"]
2.httpヘッダ
let headers = [ "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "Content-Type": "application/x-www-form-urlencoded" ]
3.Authentication私の入力であります
http://myapi.com/rest/index.php
Almofire http postメソッドを使ってどのように使用できますか?
OK。だから、それは私が言及しているもののURL untenticationにログインを求め、その前に私はヘッダーフィールドでフォームデータ本体とヘッダにパラメータを置くことによって、ポストマンでそれをチェックしていますURLCredential letのユーザー=「USER1」との私の質問の認証にパスワードを聞かせて=「パスワード1」 – Bhagabata
Almofireは言うHTTP基本認証 自動的に適切なURLAuthenticationChallengeにURLCredentialを提供しますリクエストの認証方法: LETユーザー= "あなた"ser" let password = "password" Alamofire.request( "https://httpbin.org/basic-auth/\(user)/\(password)") .authenticate(user:user、password:password) ) .responseJSON { のdebugPrint(応答) } – Bhagabata
そのユーザーとパスワードは、HTTP認証の一部か単純なパラメータですか? –