0

I'm creating a desktop app using C#. I've downloaded the Google.GData.Application to start working with the API. From this link I found this code:

            var service = new GoogleMailSettingsService("my domain", "API KEY");
            service.setUserCredentials("my username", "my pass");

            var res = service.UpdatePop("my username", "true", "ALL_MAIL", "KEEP");

I created a simple console app and ran this code (it is the only code running). However whenever I run it, I get an exception with the 403 status code. My question is:

  1. Is there anything wrong I've done? I mean, is there any additional step(s) I need to take? I've got the my domain and API key parts from here. I registered a domain and added the code and information to get the codes.

  2. Is there any way to not use my domain? This app is not for me and is not a web app that is on a specific domain. It's a desktop app and is expected to run on any machine with .Net installed.

Thanks.

Kara
  • 6,115
  • 16
  • 50
  • 57
Alireza Noori
  • 14,961
  • 30
  • 95
  • 179

1 Answers1

1

Make sure the user you are authenticating with is an administrator for the Google Apps domain.

The API Key is not required when using ClientLogin (i.e. authentication with username/password), the second parameter for the GoogleMailSettingsService constructor is just a string identifying your application.

Claudio Cherubino
  • 14,896
  • 1
  • 35
  • 42