Get username in google analytics api

After getting the access token, I can get the Analytics object

    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();

    GoogleCredential credential = new GoogleCredential.Builder()
       .setTransport(httpTransport)
       .setJsonFactory(JSON_FACTORY)
       .setClientSecrets(clientId, clientId)
       .build()
       .setAccessToken(accessToken);

    Analytics analytics=new Analytics.Builder(httpTransport, JSON_FACTORY, credential)
       .setApplicationName(applicationName).build();

      

Perhaps for now, get the user I got the token with?

+3


source to share


1 answer


if you are using Accounts: list you can get the authenticated user email address of your access to Google Analytics api. I think the best way you can do this.



you can try and add profile or email area to give you a little more information about authenticated user, but then you need to go through the Google+ api to get the database.

0


source







All Articles