Comments (5)
You should login with the iOS Twitter account and perform reverse authentication with your own consumer tokens. You will end up with access tokens that will let your own application access direct messages. Let me know if it doesn't work.
from sttwitter.
Hello,
Thanks for your reply, So here is the code that i am using for fetching direct messages of any user that is login currently
-(void) getDirectMessages
{
STTwitterAPI *twitter = [STTwitterAPI twitterAPIWithOAuthConsumerName:nil
consumerKey:ConsumerKey
consumerSecret:ConsumerSecret];
[twitter postReverseOAuthTokenRequest:^(NSString *authenticationHeader)
{
STTwitterAPI *twitterAPIOS = [STTwitterAPI twitterAPIOSWithFirstAccount];
[twitterAPIOS verifyCredentialsWithSuccessBlock:^(NSString *username) {
[twitterAPIOS postReverseAuthAccessTokenWithAuthenticationHeader:authenticationHeader
successBlock:^(NSString *oAuthToken,
NSString *oAuthTokenSecret,
NSString *userID,
NSString *screenName) {
STTwitterAPI *x = [STTwitterAPI twitterAPIWithOAuthConsumerName:nil
consumerKey:ConsumerKey
consumerSecret:ConsumerSecret
oauthToken:oAuthToken
oauthTokenSecret:oAuthTokenSecret];
[x verifyCredentialsWithSuccessBlock:^(NSString *username)
{
[x getDirectMessagesSinceID:nil count:100 successBlock:^(NSArray *messages)
{
NSLog(@"%@",messages);
[AMISharedMessageResources getSharedMessageResources].rawRecentMessages = [NSMutableArray arrayWithArray:messages];//messages;
[self parseRecentMessages];
// ...
} errorBlock:^(NSError *error) {
if ([self.delegate respondsToSelector:@selector(recentMessagesFetchingError)]) {
[self.delegate recentMessagesFetchingError];
}
NSLog(@"%@",error);
// ...
}];
} errorBlock:^(NSError *error) {
if ([self.delegate respondsToSelector:@selector(recentMessagesFetchingError)]) {
[self.delegate recentMessagesFetchingError];
}
NSLog(@"%@",error);
}];
} errorBlock:^(NSError *error) {
if ([self.delegate respondsToSelector:@selector(recentMessagesFetchingError)]) {
[self.delegate recentMessagesFetchingError];
}
NSLog(@"%@",error);
}];
} errorBlock:^(NSError *error) {
if ([self.delegate respondsToSelector:@selector(recentMessagesFetchingError)]) {
[self.delegate recentMessagesFetchingError];
}
NSLog(@"%@",error);
}];
} errorBlock:^(NSError *error) {
if ([self.delegate respondsToSelector:@selector(recentMessagesFetchingError)]){
[self.delegate recentMessagesFetchingError];
}
NSLog(@"%@",error);
}];
}
And i am using the consumer secret and consumer key of my own twitter App(that i developed using my own twitter credentials), so problem is that if i login on device using my own account then this application/code fetches my Direct messages but if i login on device using any other twitter account then this application/code showing this Error
Error Domain=STHTTPRequest Code=93 "This application is not allowed to access or delete your direct messages." UserInfo=0xaaa2250 {NSLocalizedDescription=This application is not allowed to access or delete your direct messages.}
As per my understanding through this code i can only access my own direct messages. So if my application want to access any other user direct messages on behalf of his account then we have to get twitter approval for "XAUTH" that's why i submitted request to twitter but they rejected by saying may be some other Authentication is more suitable for you.
Or please guide me if any other authentication is more suitable for my app other then reverse authentication. As i m already facing the Rest api limit issues because my app have direct message chat system as well.
Thanks
Thanks
from sttwitter.
As per Twitter i have to first implement complete web based Auth flow for "getting a Special Request Token" and after it i will request for "Access Token " for Actual reverse authentication and then my app can access any users Direct messages then i would not face this issues for getting any user direct messages
"Error Domain=STHTTPRequest Code=93 "This application is not allowed to access or delete your direct messages." UserInfo=0xaaa2250 {NSLocalizedDescription=This application is not allowed to access or delete your direct messages.}"
If i am right then how can i do the web based Auth flow using your library and will process further for getting the any user direct message and not only mine.
Thanks
from sttwitter.
I haven't tested yet but I think your users should be able to access their direct messages if:
- you use the web based authentication, as in the STTwitter iOS demo project
- you setup your Twitter application permissions to access direct messages
Let me know it it works or not.
from sttwitter.
I just tested the methodology I advised in my last message and it works, so:
- make sure your Twitter app is set to access direct messages (you don't need Twitter's approval for that)
- authenticate your user with web-based authentication (as in STTwitter iOS demo project)
- perform reverse auth. and let any user access their direct messages https://gist.github.com/nst/8052682
from sttwitter.
Related Issues (20)
- _getUserStreamStallWarning:... cancelling on receiving friends list?
- Attachment_url HOT 2
- postTokenRequest never callsback success or failure HOT 1
- Use of API only available in iOS 8
- Support for new events APIs HOT 1
- Modify character counter to take into account usernames at beginning of tweets HOT 1
- Carthage Support HOT 1
- STTwitter and iOS 11 HOT 2
- Twitter API request with JSON body HOT 2
- STTwitter in macOS 10.13 HOT 3
- Saving account to device settings HOT 1
- Perform video uploads from local NSData
- SLServiceTypeTwitter is deprecated in ios11 objc "SLServiceTypeTwitter' is deprecated: first deprecated in iOS 11.0"
- media_ids parameter is invalid.
- newest XCode throws warnings: This block declaration is not a prototype
- ⚠️ Legacy APIs must be migrated to new ones within 5 months! HOT 2
- Supporting “full_text” of a tweet with “tweet_mode=extended” HOT 1
- Twitter API 2.0
- How do I set up to jump to the Twitter App to sign in?
- Thread 1: "-[STTwitterAppOnly postTokenRequest:authenticateInsteadOfAuthorize:forceLogin:screenName:oauthCallback:errorBlock:]: unrecognized selector sent to instance 0x280371140" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sttwitter.