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

  • OAuth2ClientHttpRequestFactory and extra request parameters

    Have another problem with OAuth2ClientHttpRequestFactory in this time
    Check out this code:
    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 - https://graph.facebook.com/me/friends?metadata=1. 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.

    Comment

    Working...
    X