You need to pass the Oauth token to the service. Check out my code here: https://github.com/Webreaper/PicasawebSync/blob/master/src/main/java/com/otway/picasasync/webclient/GoogleOAuth.java
getRefreshedCredentials setups the credentials and returns them in a GoogleCredential object with the refreshed token. You then pass that to the PicasaWebService constructor, which calls: service.setOAuth2Credentials( credential ); ( https://github.com/Webreaper/PicasawebSync/blob/master/src/main/java/com/otway/picasasync/webclient/PicasawebClient.java ) I believe the API you're using (setUserCredentials, that takes a user/pass) is no longer supported. So you have to use Oauth. Feel free to use the code in my project - I wrote it explicitly to decouple the service/OAuth from the rest of my code, so that others could use it (figuring out the OAuth flow takes a bit of work...). On Wed, 29 Apr 2015 at 16:17 Alex Harvy <[email protected]> wrote: > HI , > > I have get Refresh Token and Access Token using oAuth and calandar events > > Now i want to get the list of all Picasa album by Refresh or access token > using Google.GData API. > > > I get Refresh Token Like this > > > public static GoogleAuthenticator GetAuthenticator(string > authorizationCode, string _clientId, string _clientSecret, string > _redirectUri) > { > var client = new > NativeApplicationClient(GoogleAuthenticationServer.Description, _clientId, > _clientSecret); > IAuthorizationState state = new AuthorizationState() { > Callback = new Uri(_redirectUri) }; > state = client.ProcessUserAuthorization(authorizationCode, > state); > > var auth = new > OAuth2Authenticator<NativeApplicationClient>(client, (c) => state); > auth.LoadAccessToken(); > > > > return new GoogleAuthenticator(auth); > } > > public static GoogleAuthenticator RefreshAuthenticator(string > refreshToken, string _clientId, string _clientSecret) > { > var state = new AuthorizationState(_scopes) > { > RefreshToken = refreshToken > }; > > var client = new > NativeApplicationClient(GoogleAuthenticationServer.Description, _clientId, > _clientSecret); > bool result = client.RefreshToken(state); > > > var auth = new > OAuth2Authenticator<NativeApplicationClient>(client, (c) => state); > auth.LoadAccessToken(); > > return new GoogleAuthenticator(auth); > } > > public class GoogleAuthenticator > { > private OAuth2Authenticator<NativeApplicationClient> > _authenticator; > > public > GoogleAuthenticator(OAuth2Authenticator<NativeApplicationClient> > authenticator) > { > _authenticator = authenticator; > } > > internal IAuthenticator Authenticator > { > get { return _authenticator; } > } > > public bool IsValid > { > get > { > return _authenticator != null && > DateTime.Compare(DateTime.Now.ToUniversalTime(), > _authenticator.State.AccessTokenExpirationUtc.Value) < 0; > } > } > > public string RefreshToken > { > get { return _authenticator.State.RefreshToken; } > } > > public string AccessToken > { > get { return _authenticator.State.AccessToken; } > } > } > > > > > > To get the Picasa feed we need the username and password. but i want to > access this using refresh token. > > I tried this > > PhotoQuery query = new > PhotoQuery(PicasaQuery.CreatePicasaUri(txtUserName.Text, > e.CommandArgument.ToString())); > PicasaService service = new PicasaService("Picasa"); > service.setUserCredentials("UserName", "Password"); > PicasaFeed feed = service.Query(query); > > but for above code i need to pass the Username and password every time. I > need this be done through Refresh Token. > > Is It possible ? > > > Can you please suggest ? > > -- > You received this message because you are subscribed to the Google Groups > "Google Picasa Web Albums API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at http://groups.google.com/group/google-picasa-data-api. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Picasa Web Albums API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-picasa-data-api. For more options, visit https://groups.google.com/d/optout.
