简体   繁体   English

浏览器的Twitter注销未反映在应用程序中

[英]Twitter Logout from browser not reflecting in app

I have used STTwitterAPI to login using either ACAccountStore or browser. 我已经使用STTwitterAPI使用ACAccountStore或浏览器登录。

Here's a condition thats creating issue for me. 这是为我制造问题的条件。 When user logs in app using Twitter from browser(default safari), he gets call-backed to app and STTwitterAPI object stores the data. 当用户使用Twitter从浏览器(默认的野生动物园)使用Twitter登录应用程序时,他将被STTwitterAPI回应用程序,并且STTwitterAPI对象存储数据。

Everything works fine. 一切正常。 I can even tweet using that account. 我什至可以使用该帐户发布推文。 But if user switches to browser(default safari) and logs out from Twitter account(which he used while logging) and returns to app to tweet, it is done successfully with old account (associated earlier in browser before logging out), which should not be the case. 但是,如果用户切换到浏览器(默认的safari)并从Twitter帐户(登录时使用的)注销并返回到应用程序以进行tweet,则使用旧帐户(注销之前在浏览器中关联的旧帐户)成功完成了此操作,就是这样。

I want to ask the user again for logging in as he logged out from browser. 我想再次询问用户从浏览器注销时是否登录。 I even tried using verifyCredentialsWithSuccessBlock:errorBlock : but it returns me user details of old user(the one logged out). 我什至尝试使用verifyCredentialsWithSuccessBlock:errorBlock :但这会返回我旧用户的用户详细信息(已注销的用户)。

UPDATE: 更新:

App doesn't redirects user to browser after user is logged in. My concern is if user opens twitter in the browser out of volition, he is shown logged in to an account used while logging in(and that should be the case), but now user decides to either log out from that account or wishes to change account and logs out the account(used during login) from browser. 用户登录后,应用程序不会将用户重定向到浏览器。我担心的是,如果用户出于自愿退出浏览器中的Twitter,则会显示他已登录到登录时使用的帐户(应该是这种情况),但是现在,用户决定从该帐户注销或希望更改帐户,然后从浏览器注销该帐户(登录期间使用的帐户)。

It gets logs out (which is fine) but when he returns to app, and try to tweet or do anything of twitter account, he should be asked for log in again. 它可以注销(很好),但是当他返回应用程序并尝试发布推特或执行任何Twitter帐户操作时,应要求他再次登录。 For that i used verify credentials. 为此,我使用了验证凭证。 But the access token of previous login is still valid. 但是先前登录的访问令牌仍然有效。

So, how to notify app that user has logged out of the browser or switched account. 因此,如何通知应用程序用户已退出浏览器或切换帐户。 Is there any way to achieve. 有什么办法可以实现。 I'm stuck for at-least a week. 我被困了至少一周。 Tried every alternative. 尝试了所有其他选择。 None of them seems to work in my case. 在我看来,它们似乎都不起作用。 Any help would be appreciated. 任何帮助,将不胜感激。 Thank You!!! 谢谢!!!

I haven't used the STTwitter framework much. 我还没有使用过STTwitter框架。 But I can confidently say that TwitterKit by Fabric is much easier to use. 但是我可以自信地说,Fabric的TwitterKit更易于使用。 I have used it for the scenario of SignUp and SignOut for Twitter in my app and it works flawlessly with the methods provided by it. 我已经在我的应用程序中将其用于SignUp和SignOut for Twitter的场景,并且可以完美地使用它提供的方法。 You can check it out here: 您可以在这里查看:

https://dev.twitter.com/twitter-kit/ios/twitter-login https://dev.twitter.com/twitter-kit/ios/twitter-login

The syntax for login is like this: 登录的语法如下:

[[Twitter sharedInstance] logInWithCompletion:^
            (TWTRSession *session, NSError *error) {
  if (session) {
      NSLog(@"signed in as %@", [session userName]);
  } else {
      NSLog(@"error: %@", [error localizedDescription]);
  }
}];

And for logout you have a – logOut method respectively. 对于注销,您分别具有– logOut方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM