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= new List<UserCredential>();
esle
   List<UserCredential> Credentials=(List<UserCredential>)Session["Credentials"];

    UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                             new ClientSecrets
                             {
                                 ClientId = "Client_ID",
                                 ClientSecret = "Client_Secret"
                             },
                             Scopes,
                             "me",
                             CancellationToken.None,
                             new FileDataStore(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"