Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Token Based Reconnection and tested everything #758

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andresinaka
Copy link
Contributor

@chrisballinger I implemented Token Based Reconnection. DON'T MERGE YET

Here is the documentation:
http://mongooseim.readthedocs.io/en/latest/open-extensions/token-reconnection/
http://www.xmpp.org/extensions/inbox/token-reconnection.html

There is something I can't find a way of implementing it, maybe you can give a clue:

When authenticating using TBR you send:

<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="X-OAUTH">here_goes_the_token</auth>

There are two types of tokens, the Access token that never changes and the Refresh Token that is refreshed every time you send it to the server, so after sending the <auth> with a Refresh Token the server will respond the following:

<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">new_refresh_token</success>   

And I need a way of being able to get that new_refresh_token. The different ways I found of doing this are:

  • Make the id <XMPPSASLAuthentication> auth; from XMPPStream public (just the getter) and store the new_refresh_token in the auth (XMPPTBRAuthentication) so I can do somethign like this in the xmppStreamDidAuthenticate:
func xmppStreamDidAuthenticate(sender: XMPPStream!) {       
    print(sender.auth.refreshToken)
}
  • Add a new delegate to XMPPStream.h something like:
- (void)xmppStreamDidRefreshTBRToken:(NSSTring *)token;

And call that method from - (void)handleAuth:(NSXMLElement *)authResponse in XMPPStream.m checking if auth is from type XMPPTBRAuthentication and grab the new_refresh_token from the authResponse

What do you think???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant