google-api-dotnet-client

Connect to Google api via asp .net core causes endless authorization loop

孤者浪人 提交于 2020-07-28 04:46:53
问题 I am currently trying to set up an Asp .net core 3 web project to connect to Google calendar and request user data after the user has logged in. The user logs in and the application requests permission to access their data. The problems start after that. start up // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite(

how to get email after using google OAuth2 in C#?

可紊 提交于 2020-07-22 10:55:22
问题 I get credentials using code static string[] Scopes = { "https://www.googleapis.com/auth/userinfo.email" }; private static UserCredential GenerateCredential() { UserCredential credential; 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 =

Google Calendar API Service Account Error 401 Invalid credential

≯℡__Kan透↙ 提交于 2020-05-31 03:44:09
问题 I'm trying to create a Google Calendar Service Account. Here are my credentials: Here's my service account definition (Site Wide delegation for service account is enabled): Here's my "Manage API client access" page: And this is my code: string userName = "xxx@yyy.it"; string[] Scopes = { CalendarService.Scope.Calendar, CalendarService.Scope.CalendarEvents }; string ApplicationName = "Client per quickstart"; ServiceAccountCredential credential = GoogleCredential.FromFile(@"path\credentialjson