Hi Shraddha,

Thanks for you reply,

Here is my code:
 This is my fetching request token  code (my scope : OAUTH_SCOPE = "
https://apps-apis.google.com/a/feeds/emailsettings/2.0/";)


      *GoogleOAuthParameters*  *oauthParameters = new
GoogleOAuthParameters();
        oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
        oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
        oauthParameters.setScope(OAUTH_SCOPE);
        oauthParameters.setOAuthCallback("
http://localhost:8080/MailBoxDelegation/redirectservlet";);

        **GoogleOAuthHelper ** oauthHelper = new GoogleOAuthHelper(new
OAuthHmacSha1Signer());
         oauthHelper.getUnauthorizedRequestToken(oauthParameters);

         String approvalPageUrl =
oauthHelper.createUserAuthorizationUrl(oauthParameters);

            String oauth_secret = oauthParameters.getOAuthTokenSecret();
             session.setAttribute("oauth_secret",oauth_secret);

            approvalPageUrl =
oauthHelper.createUserAuthorizationUrl(oauthParameters);
           response.sendRedirect(approvalUrl);*

The code after the redirection :

     *          String CONSUMER_KEY = props.getProperty("CONSUMER_KEY");
                String CONSUMER_SECRET =
props.getProperty("CONSUMER_SECRET");

                GoogleOAuthParameters oauthParameters = new
GoogleOAuthParameters();
                oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
                oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
                String oauth_secret =
session.getAttribute("oauth_secret").toString();

OAuthHmacSha1Signer sign = new OAuthHmacSha1Signer();
  GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(sign);
oauthHelper.getOAuthParametersFromCallback(request.getQueryString(),
oauthParameters);
                oauthParameters.setOAuthTokenSecret(oauth_secret);

           String accessToken = "";
                try {
                  accessToken = oauthHelper.getAccessToken(oauthParameters);

                    session.setAttribute("access_token", accessToken);
                    response.sendRedirect("delegation.jsp");
                } catch (OAuthException e) {
                logger.log(Level.SEVERE,"erreur during access token -->
"+e.getMessage());
                }*


the code for the creation of the service

 *EmailListService service = new EmailListService(appName);
         try {
            service.setOAuthCredentials(oauthParameters, new
OAuthHmacSha1Signer());


        } catch (OAuthException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }*

Here is Sthe url that I'm using to get a feed:
https://apps-apis.google.com/a/feeds/emailsettings/2.0/domain/userName/delegation

I hope it will help.
just for information, I did nothing for the registration of my webapp
because in the management board it was already a client name with my domain
name which had access to all APIs  (I don't know if the issue comes from
that)

Thanks in advance for your help

Robert

2011/12/15 Shraddha Gupta <[email protected]>

> Hello Robert,
>
> Can you send the code where you are doing OAuth authentication?
>
> Thanks,
> Shraddha Gupta
> Developer Programs Engineer
> Hyderabad, Google India.
>
>
>
> On Thu, Dec 15, 2011 at 4:58 AM, robert dupont 
> <[email protected]>wrote:
>
>> Hi,
>> I'm trying to get the emailsettings feed with an Oauth authentication but
>> in my web app I have the following issue : Unknow authorization header. I
>> can retrieve an access token and the secret. But when I copy and paste
>> these values in the Oauth playground I get the next error.
>> If I do all the process to obtain the access token using the playground I
>> can retrieve a feed. But with the values retrieved with my web app no
>> success.
>> I really don't know why I have this issue.
>>
>> Thanks in advance for your help
>>
>> Robert.
>>
>> HTTP/1.1 401 Unknown authorization header
>> WWW-Authenticate: GoogleLogin 
>> realm="http://www.google.com/accounts/ClientLogin";, service="apps"
>> Content-Type: text/html; charset=UTF-8
>> Date: Wed, 14 Dec 2011 23:20:15 GMT
>> Expires: Wed, 14 Dec 2011 23:20:15 GMT
>> Cache-Control: private, max-age=0
>> X-Content-Type-Options: nosniff
>> X-Frame-Options: SAMEORIGIN
>> X-XSS-Protection: 1; mode=block
>> Server: GSE
>> Transfer-Encoding: chunked
>>
>> <?xml version="1.0"?>
>> <HTML>
>>   <HEAD>
>>     <TITLE>Unknown authorization header</TITLE>
>>   </HEAD>
>>   <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
>>     <H1>Unknown authorization header</H1>
>>     <H2>Error 401</H2>
>>   </BODY>
>> </HTML>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Apps Domain Information and Management APIs" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-apps-mgmt-apis/-/0_El9oDUSv4J.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Apps Domain Information and Management APIs" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Apps Domain Information and Management APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Reply via email to