Search code examples
c#.netgoogle-docsgoogle-docs-api

How to Authorize the service object for a specific user


In google docs api Developer's guide at many places it says // TODO: Authorize the service object for a specific user Can any one please tell how to do that exactly.. especailly in my case where for authentication I'm sending a POST request to https://www.google.com/accounts/ClientLogin and then parsing Authentication token.


Solution

  • You can use the following code to have the library perform ClientLogin for you:

    service.setUserCredentials(username, password);
    

    For more details, check https://developers.google.com/google-apps/documents-list/#authorizing_requests_with_clientlogin