You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oltu.apache.org by "Prasad (JIRA)" <ji...@apache.org> on 2013/11/25 15:14:35 UTC

[jira] [Comment Edited] (OLTU-129) Unable to add headers to OAuthclientRequest

    [ https://issues.apache.org/jira/browse/OLTU-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13831472#comment-13831472 ] 

Prasad edited comment on OLTU-129 at 11/25/13 2:14 PM:
-------------------------------------------------------

i am making a token request as

OAuthClientRequest request = OAuthClientRequest
	                .tokenLocation("*********************/oauth/token")
	                .setGrantType(GrantType.AUTHORIZATION_CODE)
	                .setClientId("codeclient")
	                .setClientSecret("secret")
	                .setRedirectURI("https://localhost:8443")
	                .setCode(code)
	                .buildQueryMessage();

		String authorisation = clientId + ":" + clientSecret;
                byte[] encodedAuthorisation = Base64.encode(authorisation.getBytes());
		request.addHeader("Authorization", "Basic " + encodedAuthorisation.toString());
                  OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
                    GitHubTokenResponse oAuthResponse;
		   oAuthResponse = oAuthClient.accessToken(request, GitHubTokenResponse.class);

Pleasae guide me if i am doing anything wrong here.
How can i do basic authentication when making a request to Token end point?


was (Author: prasadnadendla):
i am making a token request as

OAuthClientRequest request = OAuthClientRequest
	                .tokenLocation("*********************/oauth/token")
	                .setGrantType(GrantType.AUTHORIZATION_CODE)
	                .setClientId("codeclient")
	                .setClientSecret("secret")
	                .setRedirectURI("https://localhost:8443")
	                .setCode(code)
	                .buildQueryMessage();

		String authorisation = clientId + ":" + clientSecret;
                byte[] encodedAuthorisation = Base64.encode(authorisation.getBytes());
		request.addHeader("Authorization", "Basic " + encodedAuthorisation.toString());
                  OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
                    GitHubTokenResponse oAuthResponse;
		   oAuthResponse = oAuthClient.accessToken(request, GitHubTokenResponse.class);

Pleasae guide me if i am doing anything wrong here.

> Unable to add headers to OAuthclientRequest
> -------------------------------------------
>
>                 Key: OLTU-129
>                 URL: https://issues.apache.org/jira/browse/OLTU-129
>             Project: Apache Oltu
>          Issue Type: Bug
>          Components: oauth2-client
>    Affects Versions: 0.31
>         Environment: Java web application,windows 7,Eclipse
>            Reporter: Prasad
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Hi,
> I am unable to Pass Http headers to the token endpoint request.
> I would like to use basic authentication.could you please guide me how can i pass headers to the request?



--
This message was sent by Atlassian JIRA
(v6.1#6144)