Gmail API: Force authorization to reprocess a user

The credentials allowing access to the gmailAPI appear to be cached. When I change the client ID and secret and email address, nothing changes. Also, when I change the scope, nothing changes. I am trying to get the credentials to update. Is there a way to force the credentials to repurpose the user?

Is there a file I can find and delete?

I am using C # and the gmail api package from nuget. Code to check:

 _emailAddress = Settings.EmailAddress;
string clientSecret = Settings.ClientSecret;
string clientId = Settings.ClientId;
ClientSecrets clientSecrets = new ClientSecrets {ClientId = clientId, ClientSecret = clientSecret};
UserCredential credential;
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
    clientSecrets,
    Scopes,
    "user",
    CancellationToken.None).Result;

_service = new GmailService(new BaseClientService.Initializer()
{
   HttpClientInitializer = credential,
   ApplicationName = "Draft Sender", //applicationName,
});

      

Also, once I make sure my scope is set: I cannot change the scope until I delete and update the secret and clientID. In addition, generating credentials requires two pass-through runs, the first leading to an error and the second leading to an authorization prompt.

I'm pretty sure this is because the credentials are cached somewhere, although I haven't specified any storage either ... but I don't know for sure. Anyway, the problem seems to depend on the code inside the gmail api package, but I am having a hard time finding a solution for what I mean.

Ultimately I need to deploy the functionality to an ASP website that will access the gmail account as the store for the email, so I need this authorization to be figured out so that the server can access the email account when deploying ( or easily after). It is not necessary (but desirable) for this to happen without an intermediate error.

Is there a solution (easy or difficult) to manage this caching process and handle permissions?

+3


source to share





All Articles