Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This builds upon the work done in PR 381. That ticket is on hold because it was perceived to be a Google specific issue, but I think the issue is broader then that. I noticed the same issue on SalesForce and Issue #26 reports the same issue for Facebook. I took a look at the oAuth specification and I think I see where the disconnect is. Take a look at the diagram in this section on authorization flow: https://tools.ietf.org/html/rfc6749#section-1.5
G and H in the diagram document the refresh-token flow and according to H the server may optionally return a new refresh token as part of that request. For environments that don't expire the refresh token, it is never returned. I think since the RFC for it says it's optional we should account for it at the abstract service layer.
This takes the approach in PR 381 but with an added check to be sure the refresh token is absent before it carries it over, to ensure it doesn't break flows that do decide to return a new refresh token.