Have another problem with OAuth2ClientHttpRequestFactory in this time
Check out this code:
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.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); } }



Reply With Quote