I'm working on a .NET desktop app that needs interaction with Youtube APIs.I'm following the first sample at https://developers.google.com/youtube/v3/code_samples/dotnet
My code runs fine, but I want to force the user to select the right Google account every time the application starts.
I've tried the following modification of the above sample:
UserCredential credential; using (var stream = new FileStream("Assets\\client_secret.json", FileMode.Open, FileAccess.Read)) { credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( new GoogleAuthorizationCodeFlow.Initializer { ClientSecretsStream = stream, Prompt = "select_account" // <-- This line does nothing... }, new[] { YouTubeService.Scope.YoutubeReadonly },"user", CancellationToken.None ); }To my understanding, based on this old similar question, adding the Prompt = "select_account" parameter should do the trick but in reality it doesn't work as expected.
Infact it appears that the credentials are somewhat cached and the desired prompt never appears.
I've even tried to recompile the code in this way:
//omissis... new GoogleAuthorizationCodeFlow.Initializer { ClientSecrets = new ClientSecrets(), // <- no reference to the stream! Prompt = "select_account" },and with my big surprise the app still work without any reference to the client_secret.json stream! Authentication is skipped completely after the user successfully logs in for the first time