Ok two things, I should use
signer.tokenSharedSecret for Domains? and signer.clientSharedSecret for Gmail applications or is non-sense? For this sample that you have sent is returning the same error. GoogleOAuthGetTemporaryToken temporaryToken = new GoogleOAuthGetTemporaryToken(); temporaryToken.callback = "oob"; signer = new OAuthHmacSigner(); signer.tokenSharedSecret = consumerSecret; temporaryToken.signer = signer; temporaryToken.consumerKey = consumerKey; temporaryToken.scope = "https://apps-apis.google.com/a/feeds"; temporaryToken.transport = new NetHttpTransport(); OAuthCredentialsResponse tempCreds = temporaryToken.execute(); Exception in thread "main" com.google.api.client.http.HttpResponseException: 400 Bad Request at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:380) at com.google.api.client.auth.oauth.AbstractOAuthGetToken.execute(AbstractOAuthGetToken.java:73) at GroupSettingTests.main(GroupSettingTests.java:33) url GoogleOAuthGetTemporaryToken (id=18) callback "oob" (id=27) classInfo ClassInfo (id=32) consumerKey "ajsolutions.me" (id=34) displayName "appTest" (id=31) fragment null host "www.google.com" (id=35) keySet null pathParts ArrayList<E> (id=36) port -1 scheme "https" (id=42) scope "https://apps-apis.google.com/a/feeds" (id=45) signer OAuthHmacSigner (id=46) clientSharedSecret ----consumerSecret----- (id=124) tokenSharedSecret ----consumerSecret----- (id=124) transport NetHttpTransport (id=49) unknownFields ArrayMap<K,V> (id=52) usePost false values null Alexandre Jacquet Google Apps Deployment Specialst São Paulo | SP | Brasil Tel.: 55 11 8064 6882 On Tue, Jun 14, 2011 at 9:14 PM, Aaron <[email protected]> wrote: > Alexandre- > > You also need to set the callback parameter. You can find that information > about the parameters that you need here: > http://code.google.com/apis/accounts/docs/OAuth_ref.html > > The following may help you... The following illustrates the process for > setting up OAuth 1.0 using the google-api-java-client for a client > application (non-web application): > > // Step 1: Get OAuth Request Token > GoogleOAuthGetTemporaryToken temporaryToken = > new GoogleOAuthGetTemporaryToken(); > temporaryToken.callback = "oob"; > signer.clientSharedSecret = <CLIENT_SHARED_SECRET_HERE>; > temporaryToken.signer = signer; > temporaryToken.consumerKey = <CONSUMER_KEY_HERE>; > temporaryToken.scope = "https://apps-apis.google.com/a/feeds"; > temporaryToken.transport = new NetHttpTransport(); > OAuthCredentialsResponse tempCreds = temporaryToken.execute(); > > // Step 2: Get OAuth Authorize Token > signer.tokenSharedSecret = tempCreds.tokenSecret; > GoogleOAuthAuthorizeTemporaryTokenUrl authorizeUrl = new > GoogleOAuthAuthorizeTemporaryTokenUrl(); > authorizeUrl.temporaryToken = tempCreds.token; > String authorizationUrl = authorizeUrl.build(); > System.out.println("Go to this authorizationUrl: " + authorizationUrl); > BufferedReader inStream = new BufferedReader(new > InputStreamReader(System.in)); > System.out.print("Paste verification code: "); > String verifier = inStream.readLine(); > > // Step 3: Get OAuth Access Token > GoogleOAuthGetAccessToken accessToken = new GoogleOAuthGetAccessToken(); > accessToken.temporaryToken = tempCreds.token; > accessToken.signer = signer; > accessToken.consumerKey = <CONSUMER_KEY_HERE>; > accessToken.verifier = verifier; > accessToken.transport = new NetHttpTransport(); > OAuthCredentialsResponse creds = accessToken.execute(); > signer.tokenSharedSecret = creds.tokenSecret; > > -Aaron > > -- > 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/-/MYOhaFKjAdUJ. > > 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.
