Как получить токен доступа после входа пользователя в Google в приложении Android? - PullRequest
0 голосов
/ 20 января 2020

Я использую этот код в android для входа в систему с помощью Google. Теперь я хочу получить токен доступа для доступа к API YouTube. Как я могу получить это отсюда

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .build();

    // Build a GoogleSignInClient with the options specified by gso.
    mGoogleSignInClient = GoogleSignIn.getClient(this, gso);

    GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(Home.this);
    if (acct != null) {
        String personName = acct.getDisplayName();
        String personGivenName = acct.getGivenName();
        String personFamilyName = acct.getFamilyName();
        String personEmail = acct.getEmail();
        String personId = acct.getId();
        Uri personPhoto = acct.getPhotoUrl();

        emailview = (TextView) hview.findViewById(R.id.profileEmail);
        nameview=(TextView) hview.findViewById(R.id.profileName);
        profileimg=(ImageView) hview.findViewById(R.id.profileImage);

        emailview.setText(personEmail);
        nameview.setText(personName);
        Picasso.with(this).load(personPhoto).into(profileimg);
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...