ios - 如何使用 cookie 在 Instagram 中进行身份验证?
<p><p>所以我有我的 auth instagram 代码。 token 已提供但无法使用并显示消息“<code>You must to switch cookies</code>”。我必须做什么?感谢您的回答。</p>
<p>现在我尝试从 instagram 获取 token :</p>
<pre><code>NSURL *url=;
NSMutableURLRequest *request = [ init];
;
;
;
NSData *urlData;
NSHTTPURLResponse *response;
NSError *errors;
urlData = ;
NSString *string = [ initWithData:urlData encoding:NSUTF8StringEncoding];
NSRegularExpression *regex = ;
NSString *token = string;
NSTextCheckingResult *match = )];
NSString *str = [] stringByReplacingOccurrencesOfString:@"\"}"
withString:@""];
NSLog(@"%@", str);
NSString *post = ;
NSData *postData = ;
NSString *postLength = ];
request = [ init];
];
;
;
;
;
;
urlData = ;
NSString *string2 = [ initWithData:urlData encoding:NSUTF8StringEncoding];
NSLog(@"%@", string2);
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>NSDictionary *cookieProperties = [NSDictionary dictionaryWithObjectsAndKeys:
@"", NSHTTPCookieDomain,
@"\\", NSHTTPCookiePath,
@"csrftoken", NSHTTPCookieName,
@"2dfdbaaeae7752882d792e49d79c0048", NSHTTPCookieValue,
nil];
NSHTTPCookie *cookie = ;
NSArray* cookieArray = ;
NSDictionary * headers = ;
</code></pre>
<p>在 POST 请求中添加:
[请求 setAllHTTPHeaderFields:headers];</p></p>
<p style="font-size: 20px;">关于ios - 如何使用 cookie 在 Instagram 中进行身份验证?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/23220751/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/23220751/
</a>
</p>
页:
[1]