Hello,
I'm encountering an issue with the YouTube Data API and the OAuth 2.0 authorization process. I've been following the example Java code and have something like this:
InputStream in = ApiExample.class.getResourceAsStream(CLIENT_SECRETS);
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
FileCredentialStore credentialStore = new FileCredentialStore(new File("youtube-api.json"), JSON_FACTORY);
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(httpTransport, JSON_FACTORY, clientSecrets, SCOPES)
.setCredentialStore(credentialStore)
.setAccessType("offline")
.build();
LocalServerReceiver localReceiver = new LocalServerReceiver.Builder()
.setPort(9080)
.setHost("myweb")
.build();
Credential credential = new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user");
return credential;
I've modified the code to receive a refresh token so that I can manually go through the authorization process just once. However, for this to work, my project needs to be in production. This requires the redirect_uri in my credentials to be set to an HTTPS address. I can address this part.
The challenge I'm facing is that the redirect_uri generated by the LocalServerReceiver is in HTTP, and I'm unsure how to modify the receiver to use HTTPS while maintaining similar functionality.