Announcement Announcement Module
No announcement yet.
OAuth2ClientHttpRequestFactory and extra request parameters Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • OAuth2ClientHttpRequestFactory and extra request parameters

    Have another problem with OAuth2ClientHttpRequestFactory in this time
    Check out this code:
    protected URI appendQueryParameter(URI uri, OAuth2AccessToken accessToken) {
        try {
          String query = uri.getQuery();
          if (query == null) {
            query = ((resource.getBearerTokenName() == null) ? "oauth_token" : resource.getBearerTokenName()) + "=" + URLEncoder.encode(accessToken.getValue(), "UTF-8");
          uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment());
          return uri;
        catch (RuntimeException e) {
          throw e;
        catch (Exception e) {
          throw new RuntimeException(e);
    IMHO, totaly wrong. Suppose I have url - What happen? Exactly, factory will NOT ADD access token to request, because request has already have query parameters. Again, as I wrote earlier, http factory is not good place for oauth decoration. I think there should be specila message converter for that.

  • #2
    thanks for the report. the code is fixed on master.