oltu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prasad (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OLTU-129) Unable to add headers to OAuthclientRequest
Date Mon, 25 Nov 2013 14:14:35 GMT

    [ 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)

Mime
View raw message