मैं अब इसे इंटरनेट पर डालने के लिए इंटरनेट पर डालना चाहता हूं कि इसे कैसे कार्यान्वित किया जाए।आईओएस ट्विटर रिवर्स ओएथ
मुझे उस सर्वर को पास करने के लिए प्रवेश टोकन और ट्विटर से गुप्त अनुरोध करने की आवश्यकता है जो उपयोगकर्ताओं को मेरे आवेदन के लिए ट्वीट्स को संसाधित करेगा।
मैं इस लिंक के माध्यम दिया है https://dev.twitter.com/docs/ios/using-reverse-auth
समस्या चरण 1 वे आप चरण का एक उदाहरण देना न है 1.
यहाँ मेरी कोड है:
NSURL *url = [NSURL URLWithString:TW_OAUTH_URL_REQUEST_TOKEN];
NSDictionary *parameters = @{TW_X_AUTH_MODE_KEY:TW_X_AUTH_MODE_REVERSE_AUTH};
SLRequest *getTwitterAuth = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:url parameters:parameters];
// Assume that we stored the result of Step 1 into a var 'resultOfStep1'
NSString *S = resultOfStep1;
NSDictionary *step2Params = [[NSMutableDictionary alloc] init];
[step2Params setValue:@"kfLxMJsk7fqIuy8URhleFg" forKey:@"x_reverse_auth_target"];
[step2Params setValue:S forKey:@"x_reverse_auth_parameters"];
NSURL *url2 = [NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"];
SLRequest *stepTwoRequest =
[SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:url2 parameters:step2Params];
// You *MUST* keep the ACAccountStore alive for as long as you need an ACAccount instance
// See WWDC 2011 Session 124 for more info.
self.accountStore = [[ACAccountStore alloc] init];
// We only want to receive Twitter accounts
ACAccountType *twitterType =
[self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
// Obtain the user's permission to access the store
[self.accountStore requestAccessToAccountsWithType:twitterType
withCompletionHandler:^(BOOL granted, NSError *error) {
if (!granted) {
// handle this scenario gracefully
} else {
// obtain all the local account instances
NSArray *accounts =
[self.accountStore accountsWithAccountType:twitterType];
// for simplicity, we will choose the first account returned - in your app,
// you should ensure that the user chooses the correct Twitter account
// to use with your application. DO NOT FORGET THIS STEP.
[stepTwoRequest setAccount:[accounts objectAtIndex:0]];
// execute the request
[stepTwoRequest performRequestWithHandler:
^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *responseStr =
[[NSString alloc] initWithData:responseData
encoding:NSUTF8StringEncoding];
// see below for an example response
NSLog(@"The user's info for your server:\n%@", responseStr);
}];
}
}];
मैं कर दिया गया है यह पता लगाने की कोशिश कर रहा है कि मैं ट्विटर दस्तावेज़ों से चरण 2 तक पहुंचने के लिए एसएलआरक्वेट को कैसे संसाधित करता हूं।
मैं भी इस यहाँ का इस्तेमाल किया है: https://github.com/seancook/TWReverseAuthExample
इस कोड को महान लेकिन बहुत जटिल है। किसी भी तरह की सहायता का स्वागत किया जाएगा! धन्यवाद!
अपने काम नहीं कर रहा है, हालांकि में जा रहा है, तो ब्लॉक लेकिन क्रेडेंशियल मूल्य के साथ = " Xml संस्करण" = "\" 1.0 \ "एन्कोडिंग = \" यूटीएफ -8 \ "?> \ n \ n <त्रुटि कोड = \" 101 \ "> रिवर्स ऑथ क्रेडेंशियल्स अमान्य हैं \ n \ n"; –
Abhishek
मेरे लिए भी काम नहीं कर रहा, एक ही त्रुटि –