Получить код авторизации с помощью входа в Google - PullRequest
0 голосов
/ 24 мая 2018

Мне нужно получить auth code из YouTube-api, чтобы передать его на серверную сторону, которая затем пытается получить access token, используя auth code.Есть ли способ получить auth code с помощью библиотеки входа в Google?

Сейчас я могу получить accessToken только на устройстве:

val result = Auth.GoogleSignInApi.getSignInResultFromIntent(data)
if (result.isSuccess) {
    // Get the account from the sign in result
    val account = result.signInAccount

    // Store the account from the result
    mAccount = account?.account

    ...

    // Asynchronously access the People API for the account
    val credential = GoogleAccountCredential.usingOAuth2(context, Collections.singleton(YOUTUBE_SCOPE))
    credential.selectedAccount = mAccount

    val token = credential.token
}

И я не нашел способа получить auth code без использования webview.

...