0

Google has new api Google.Apis.

I have desktop application which authorize user by google account. Old API stop working.

How can I authorize user by new API, but WITHOUT webauthorizationBroker in C#? I do not want open webbroswer, I have own win form for enter login and password.

EDITED: Here is old code:

        string fullname = string.Empty;

        UserService userService = new UserService("APPKEY");
        userService.setUserCredentials(username, Encryptor.Decrypt(password));
        try
        {
            string token = userService.QueryClientLoginToken();


            GOAuthRequestFactory reqF = new GOAuthRequestFactory("apps", "APPKEY") { ConsumerKey = "KEY", ConsumerSecret = "SECRET" };
            userService = new UserService("APPKEY") { RequestFactory = reqF };

            UserQuery query = new UserQuery("DOMAIN", true);
            UserFeed usersFeed = userService.Query(query);
            UserEntry entry = (UserEntry)usersFeed.Entries.FirstOrDefault(f => (f as UserEntry).Login.UserName == userName);
            fullname = string.Format("{0} {1}", entry.Name.GivenName, entry.Name.FamilyName);
        }
        catch (InvalidCredentialsException ex)
        {
            service.SendError(ex.Message);

            return fullname;
        }

        return fullname;
Musketyr
  • 745
  • 1
  • 16
  • 37
  • Musketyr, consider posting your old code so that we can see what classes/api's you work with. – TarasB Apr 24 '15 at 12:52
  • You are always going to have to open a browser window to authenticate with Google. Authentication is a webpage. I supposed you could open it in a webbrowser control. But its tricky that way. – Linda Lawton - DaImTo Apr 24 '15 at 13:32
  • Open Webbrowser control is not comfortable. Application has one design and User has to log by the application. – Musketyr Apr 28 '15 at 07:03

0 Answers0