我想在我的iOS應用程序中驗證用戶,但是我得到的只是一個400錯誤。Disqus Password Credentials OAuth
按照documentation,「這種類型的流量僅限於批准的應用程序,讓你必須先請求訪問」。
那麼如何批准我的應用程序才能完成此流程?我請求
部分:
NSURL *url = [NSURL URLWithString:@"https://disqus.com/api/oauth/2.0/access_token/"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:WS_TIMEOUT];
NSString *strAuth = [NSString stringWithFormat:@"%@:%@", username, password];
NSString *strAuthBase64 = [[strAuth dataUsingEncoding:NSUTF8StringEncoding] base64EncodedString];
NSString *postString = [NSString [email protected]"grant_type=password&client_secret=%@&client_id=%@&scope=read,write", DISQUS_SECRET, DISQUS_KEY];
[request addValue:[NSString stringWithFormat:@"Basic %@", strAuthBase64] forHTTPHeaderField:@"Authorization"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
在此先感謝。
看起來真不錯! –