Java GoogleOAuth重定向URL,LocalServerReceiver端口号

Java GoogleOAuth重定向URL,LocalServerReceiver端口号,java,youtube-api,youtube-data-api,google-oauth,Java,Youtube Api,Youtube Data Api,Google Oauth,我有一个基于java的web应用程序,可以下载给定视频的youtube评论。它在本地运行得很好,但当我将其部署到amazon clound时,它指出由于回调url问题,身份验证过程中会出现所有错误 GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, scopes).setCre

我有一个基于java的web应用程序,可以下载给定视频的youtube评论。它在本地运行得很好,但当我将其部署到amazon clound时,它指出由于回调url问题,身份验证过程中会出现所有错误

    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
            HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, scopes).setCredentialDataStore(datastore)
            .build();

    // Build the local server and bind it to port xxxxx
    LocalServerReceiver localReceiver = new LocalServerReceiver.Builder().setPort( 15555 ).build(); 
    // Authorize.
    Credential credential = new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user");
   );
    return credential;
以上代码片段取自youtube开发人员网站

我的问题是,由于从youtube获取访问令牌的
localReceiver
运行在端口15555上,因此
localReceiver
无法从youtube获得响应,因为我的站点位于亚马逊云上,只有端口80可以从外部访问。对吗

换句话说,如果我的重定向uri是
redirect\u uri=http://mysite.elasticbeanstalk.com:15555/Callback&response_type=code&scope=https://www.googleapis.com/auth/youtube.force-ssl
,因为它位于端口15555上,所以无法工作。我正努力想办法解决这个问题。你是怎么做到的

我找到了一个解决办法: 我在本地进行了身份验证,生成了令牌并将文件复制到服务器上,虽然不确定刷新过程是否有效,但它仍然有效。

我找到了一个解决方法:
我在本地进行了身份验证,生成了令牌并将文件复制到服务器上,虽然不确定刷新过程是否有效,但它仍然有效。

这不适用于meThis,也不适用于我