Skip to content

How I can reuse stored tokens to do future queries ? #41

@GoogleCodeExporter

Description

@GoogleCodeExporter
Which API and version (e.g. Google Calendar Data API version 2)?
  google-api-java-client.1.1.0-alpha


What format (e.g. JSON, Atom)?
  JSON and Atom

What Authentation (e.g. OAuth, OAuth 2, Android, ClientLogin)?
  We need an example to OAuth 2

Java environment (e.g. Java 6, Android 2.2, App Engine 1.3.7)?
  Java 6

External references, such as API reference guide?
  We are using the picasa API

Please provide any additional information below.

1. We are runing the picasa-atom-oauth-sample and it works perfect.
2. The example have a "private static OAuthCredentialsResponse credentials;"
3. Execute the next code to obtain the access tokens:
    GoogleOAuthGetAccessToken accessToken = new GoogleOAuthGetAccessToken();
    accessToken.temporaryToken = tempToken;
    accessToken.signer = signer;
    accessToken.consumerKey = "www.mydomain.com" /*"anonymous"*/;
    accessToken.verifier = verifier;
    credentials = accessToken.execute();
    signer.tokenSharedSecret = credentials.tokenSecret;

4. We are storing the credentials.token and credentials.tokenSecret for future 
reuse, but when we try to reuse the tokens in other programs it send me a "403 
Forbidden":
Exception in thread "main" com.google.api.client.http.HttpResponseException: 
403 Forbidden
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:219)
    at com.google.api.client.sample.picasa.model.Feed.executeGet(Feed.java:51)
    at com.google.api.client.sample.picasa.model.UserFeed.executeGet(UserFeed.java:37)
    at com.google.api.client.sample.picasa.AuthTest1.showAlbums(AuthTest1.java:54)
    at com.google.api.client.sample.picasa.AuthTest1.<init>(AuthTest1.java:46)
    at com.google.api.client.sample.picasa.AuthTest1.main(AuthTest1.java:94)

5.  We have a registered application in 
https://www.google.com/accounts/ManageDomain, and we are using the parameters:
    OAuth Consumer Key:    www.mydomani.com
    OAuth Consumer Secret: XXXXXXXXXXXXXXXXXXXXXXXX

Can you give us a correct example of how to get access and how to reuse stored 
tokens? 

Original issue reported on code.google.com by carlosec...@gmail.com on 11 Oct 2010 at 11:23

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions