Skip to content

Commit

Permalink
Merge pull request #35 from pilif/fix-request-initializer
Browse files Browse the repository at this point in the history
make AuthorizationFlow.setRequestInitializer() work
  • Loading branch information
wuman committed Mar 11, 2015
2 parents 99d80ab + cba316f commit 13bb765
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ public AuthorizationCodeTokenRequest newTokenRequest(String authorizationCode) {
return new LenientAuthorizationCodeTokenRequest(getTransport(), getJsonFactory(),
new GenericUrl(getTokenServerEncodedUrl()), authorizationCode)
.setClientAuthentication(getClientAuthentication())
.setRequestInitializer(getRequestInitializer())
.setScopes(getScopes())
.setRequestInitializer(
new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) throws IOException {
getRequestInitializer().initialize(request);
request.getHeaders().setAccept("application/json");
}
});
Expand Down

1 comment on commit 13bb765

@jmathew
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing something but this makes the Simple Oauth 2.0 (linkedIn) example fail with NullPointerException as

getRequestInitializer() == null. This is expected since there is no statement setting the request initializer when setting up the AuthorizationFlow in SimpleOauth2ExplicitActivity onActivityCreated.

Without any real understanding of the code I've just wrapped it with if(getRequestInitializer() != null)

Please sign in to comment.