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

Token-based reconnection implementation #85

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

ramabit
Copy link
Contributor

@ramabit ramabit commented Jul 12, 2016

Docs: http://www.xmpp.org/extensions/inbox/token-reconnection.html

Login with token:
xmppConnection.login(token, resourcepart);

Get tokens:
TBRManager tbrManager = TBRManager.getInstanceFor(xmppConnection);
TBRTokens tbrTokens = tbrManager.getTokens();
String accessToken = tbrTokens.getAccessToken();
String refreshToken = tbrTokens.getRefreshToken();

Get last refresh token obtained from "success" nonza:
String refreshToken = xmppConnection.getXOAUTHLastRefreshToken();

To avoid reconnection using token:
xmppConnection.avoidTokenReconnection();

@ramabit
Copy link
Contributor Author

ramabit commented Jul 12, 2016

@Flowdalic Take a look at this :)
I have a question: how could I retrieve a refresh token from a "success" Nonza after authenticating? Because the actual Smack's authentication workflow doesn't allow me to do that I believe.

@Flowdalic
Copy link
Member

Hi @ramabit. Thanks for your contribution, but I'm sorry I'm not going to review or accept a PR that is full of non semantic changes. Please fix this.

@@ -58,8 +59,8 @@
import org.igniterealtime.jbosh.ComposableBody;

/**
* Creates a connection to an XMPP server via HTTP binding.
* This is specified in the XEP-0206: XMPP Over BOSH.
* Creates a connection to an XMPP server via HTTP binding. This is specified in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non semantic change (of many)

@ramabit
Copy link
Contributor Author

ramabit commented Jul 12, 2016

@Flowdalic I understand, but the the automatic checks won't pass :/
should I ignore it?

@Flowdalic
Copy link
Member

@Flowdalic I understand, but the the automatic checks won't pass :/
should I ignore it?

I don't understand. You mean if you don't introduce non-semantic changes, then gradle check will fail? Every commit in master passes gradle check. If you base your work on master and don't introduce new checkstyle violations, then gradle check will succeed.

@ramabit
Copy link
Contributor Author

ramabit commented Jul 12, 2016

@Flowdalic Yes, you are right. But I can't use Command+Shift+F shortcut, and that makes not to introduce new checkstyle violations difficult and painful. But well, I will try

@Flowdalic
Copy link
Member

Flowdalic commented Jul 12, 2016

Most formatters have a setting to only format your own code (i.e. the code you just added or modified). Which is what you usually always want. People, especially in FOSS projects, don't like to review commits with tons of unrelated non-semantic whitespaces changes. They just distract from the real changes.

@ramabit
Copy link
Contributor Author

ramabit commented Jul 12, 2016

@Flowdalic is now ok? Should I squash the commits?

@ramabit
Copy link
Contributor Author

ramabit commented Jul 12, 2016

@Flowdalic ^ I am testing a way to retrieve the refresh token :)

@ramabit
Copy link
Contributor Author

ramabit commented Jul 13, 2016

@Flowdalic Fixes added and the problem retrieving the refresh token is solved


@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
xml.rightAngleBracket();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must/Should be setEmptyElement().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Flowdalic Done

@ramabit ramabit force-pushed the ramabit.tbr.opt2 branch 2 times, most recently from d229459 to 654e627 Compare July 29, 2016 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants