yazabara
yazabara

Reputation: 1353

Java: how to get youtube access/refresh token for app?

I have google app with credentials: app-name, api-key, client-id, client-email, client-secret ...

Is it possible to get access to youtube api without user autorization. For example with user auth I can get refresh tokern and get access token like this:

 TokenResponse response = new RefreshTokenRequest( GOOGLE_HTTP_TRANSPORT, GOOGLE_JSON_FACTORY, new GenericUrl( "https://www.googleapis.com/oauth2/v3/token" ), channelYoutubeAccess.getRefreshToken() ).setClientAuthentication( new ClientParametersAuthentication( getGoogleClientId(), getGoogleClientSecret() ) ).execute();
    if( response != null ) {
      accessToken = response.getAccessToken();
    }

Could you help me. Thank you.

Upvotes: 0

Views: 635

Answers (1)

yazabara
yazabara

Reputation: 1353

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=snippet&id=QK8mJJJvaes&_h=4&

final YouTube.Videos.List listRq = youtube.videos().list("id, status").setId(id).setKey(CLIENT_KEY);
        VideoListResponse searchResponse = listRq.execute();

Upvotes: 0

Related Questions