0

I want get last account activity with google api for installed application. The information like ip address and time from https://security.google.com/settings/security/activity. There is two ways to get this: from json and from google client libryary. I find, that i mush use google-admin-sdk. I find post Gmail's Last activity , but can't understand, how to use it. My code:

string[] scopes = new string[] {PlusService.Scope.PlusLogin,
                                        PlusService.Scope.UserinfoEmail,
                                        PlusService.Scope.UserinfoProfile};


        UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
            new ClientSecrets
            {
                ClientId = "my-client-id",
                ClientSecret = "my-client-secret"
            },
            scopes,
            Environment.UserName,
            CancellationToken.None
            ).Result;
Community
  • 1
  • 1
kostap
  • 23
  • 8

1 Answers1

0

As you said, you have to use Admin SDK to know the account's last activity. For this, you should have Google apps account and you should be the admin for that account. In admin SDK, to get the IP address, the only way is to use Email Audit API Accessing Account Information. Let me know if you have any questions.

SGC
  • 1,025
  • 1
  • 6
  • 6
  • Okay, thanks. In this page i found, that must upload public key and paste code. For using Email Audin API i must login in Google Apps Admin console? I have not got admin console. I must register in [https://www.google.com/work/apps/business/] ? – kostap Dec 10 '14 at 09:44
  • "It is not used with a Google Apps or Gmail account not hosted by the Google Apps products" - it meat, that i can't see security info of my gmail account – kostap Dec 16 '14 at 20:47