fand schließlich eine Java Update für API V3 YouTube. Im ursprünglichen Java-Beispielprogramm sind Änderungen in Auth.java erforderlich. Original ist:
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, scopes).setCredentialDataStore(datastore)
.build();
Und wir brauchen noch zwei weitere Dinge hinzufügen:
- setAccessType ("offline")
- setApprovalPrompt ("force")
dies jetzt So funktioniert Aktualisierungs-Token zu erhalten.
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, scopes).setAccessType("offline").setApprovalPrompt("force").setCredentialDataStore(datastore)
.build();
Jetzt credential.getRefreshToken() wird ein Token zurückgeben statt null. Und credential.refreshToken() wird return true statt falsch.
Sie müssen ein 'refresh_token' erhalten Ich bin mir nicht sicher, wie ich dies über Java tun soll. Hier finden Sie die Dokumentation: https://developers.google.com/youtube/v3/guides/authentication – ConorReidd