Google client
santoshpasi opened this issue · comments
I'm trying oAuth for desktop client, it is showing error. I tried following your instruction for "For desktop applications, the user will need to manually enter authorization code." as shown below:
` var login = new GoogleLogin("xxxxxx.apps.googleusercontent.com", "XXXXYYYYfv", loadUserInfo: true);
login.Owner = this;
login.ShowDialog();
// open the login page in browser
System.Diagnostics.Process.Start(login.AuthorizationUrl);
// waiting of entering the access code
string code = "";
while (String.IsNullOrEmpty(code))
{
Console.WriteLine("Enter access code:");
code = Console.ReadLine();
}
Console.WriteLine();
`
But it shows error.
The property or indexer 'Nemiro.OAuth.LoginForms.Login.AuthorizationUrl' cannot be used in this context because the get accessor is inaccessible
and
Nemiro.OAuth.LoginForms.Login.AuthorizationUrl' is inaccessible due to its protection level
Seems some restriction with "System.Diagnostics.Process.Start(login.AuthorizationUrl);"
Kindly guide me to get this resolved.
It seems that Google has changed something on the authorization page and now authorization does not work.
Thank you for message! I'll see what's up.
But I can not do it quickly. Most likely it will take at least a week.
I'm trying oAuth for desktop client, it is showing error. I tried following your instruction for "For desktop applications, the user will need to manually enter authorization code." as shown below:
If you make your own login form, then you do not need to use Nemiro.OAuth.LoginForms.
Use the client directly from Nemiro.OAuth.
var google = new GoogleClient
(
"1058655871432-83b9micke7cll89jfmcno5nftha3e95o.apps.googleusercontent.com",
"AeEbEGQqoKgOZb41JUVLvEJL"
);
// open the login page in browser
System.Diagnostics.Process.Start(google.AuthorizationUrl);
// waiting of entering the access code
string code = "";
while (String.IsNullOrEmpty(code))
{
Console.WriteLine("Enter access code:");
code = Console.ReadLine();
}
Console.WriteLine();
// set authorization code
google.AuthorizationCode = code;
// get user info
var user = google.GetUserInfo();
Console.WriteLine("User ID: {0}", user.UserId);
Console.WriteLine("Name: {0}", user.DisplayName);
Console.WriteLine("Email: {0}", user.Email);
Hello Aleksey,
Hope there is some workaround for current Google issue.
I tried using following link, but unsuccessful.
http://oauth.nemiro.net/html/aff36495-124c-a749-20ed-ce08ec915999.htm
Also if possible, kindly post one example for Logout (RevokeToken) for any client (Google or Facebook, etc).
Regards,
Santosh Pasi
Unfortunately, I do not have time to deal with this problem yet. The only solution is to make the necessary corrections yourself.
To revoke you can use method RevokeToken
of the client instance.
var result = googleClient.RevokeToken(accessToken);
if (result.IsSuccessfully)
{
// ...
}
But not all providers allow revoke access tokens (see property SupportRevokeToken
of the client instance).
Fixed in Nemiro.OAuth v1.13 and Nemiro.OAuth.LoginForms v1.7.
Thank you so much :-)