I'm trying to create a application service to be ran in a cloud server (AppHarbor) I do not directly handle, as a C# Console Application. Basically, it is a Telegram Bot that needs to access Gmail and Google Calendar. When running it locally, it propts the user via browser to give access to the account the first time.
Unfortunately, in the server I cannot give that access, so I need a way to login (authentication) directly, without need for authorization.
I've seen the option to use a Service Account, but sadly it requires GSuite to configure the user permissions and that needs payment I need to avoid.
using (var stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
{
// The file token.json stores the user's access and refresh tokens, and is created
// automatically when the authorization flow completes for the first time.
string credPath = "token.json";
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
System.Threading.CancellationToken.None,
new FileDataStore(credPath, true)).Result;
}
I have generated my json file with all the settings and secrets needed, but it still requires user interaction.
Is there any way to do so without user prompt?