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.