Skip to content Skip to sidebar Skip to footer

Gmail Api Multiple Accounts

I have 4 gmails accounts, I am building a dashboard sort of web page, where i want to show number of unread mails in all of 4 mails. But When I auth with one account it doesn't dis

Solution 1:

i think that you can do it on storing the Credential for each count, for example :

if(Session["Credentials"]==null)
    List<UserCredential> Credentials= newList<UserCredential>();
esle
   List<UserCredential> Credentials=(List<UserCredential>)Session["Credentials"];

    UserCredentialcredential= GoogleWebAuthorizationBroker.AuthorizeAsync(
                             newClientSecrets
                             {
                                 ClientId = "Client_ID",
                                 ClientSecret = "Client_Secret"
                             },
                             Scopes,
                             "me",
                             CancellationToken.None,
                             newFileDataStore(path)

                             ).Result;
Credentials.Add(Credential); 
Session["Credentials"]=Credentials;

note : you need to clear the file data wich contain ResponseToken for each authentification.

Post a Comment for "Gmail Api Multiple Accounts"