Merged OAuth2 code flow and refresh token branches