I am using google external login in my application, and I need a functionality that user can upload images from the application to his google drive.
In my localhost code
You are using GoogleWebAuthorizationBroker.AuthorizeAsync
which is designed for use with installed applications. It spanws the web browser on the machine that it runs on. This will work fine when you are working locally but it will fail when you try to run it on a server as you dont have access to spawn a browser on the server (not that it would help as the user will not see it)
what you should be using is something like this
private static readonly IAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = "PUT_CLIENT_ID_HERE",
ClientSecret = "PUT_CLIENT_SECRET_HERE"
},
Scopes = new[] { DriveService.Scope.Drive },
DataStore = new FileDataStore("Drive.Api.Auth.Store")
});
A full example can be found here Web applications (ASP.NET MVC)