标签: google-api-client

javax.net.ssl.SSLHandshakeException:在握手时远程主机关闭连接,同时在bigquery中插入行

嗨,我正在研究我已集成bigquery的android应用程序.我看到有时我们在将数据插入大查询表时会遇到很多SSL异常.我不知道如何处理这个问题.请帮助究竟是什么原因导致这个问题.这是相同的线程,但在进行流式插入api调用时没有回答Bigquery SSL错误

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946) ~[na:1.7.0_51]
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312) ~[na:1.7.0_51]
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339) ~[na:1.7.0_51]
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323) ~[na:1.7.0_51]
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563) ~[na:1.7.0_51]
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) ~[na:1.7.0_51]
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1091) ~[na:1.7.0_51]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) ~[na:1.7.0_51]
    at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:77) ~[google-http-client-1.19.0.jar:1.19.0]
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:965) ~[google-http-client-1.19.0.jar:1.19.0]
    at com.google.api.client.googleapis.batch.BatchRequest.execute(BatchRequest.java:241) ~[google-api-client-1.19.1.jar:1.19.1]
    at com.livestream.analytics.datastorage.worker.InsertApiActor$$anonfun$2$$anonfun$4.apply(InsertApiActor.scala:131) ~[analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.datastorage.worker.InsertApiActor$$anonfun$2$$anonfun$4.apply(InsertApiActor.scala:118) ~[analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.common.store.bigquery.api.BigQueryApi$.withSyncClient(BigQueryApi.scala:71) ~[analytics-common_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.datastorage.worker.InsertApiActor$$anonfun$2.apply$mcV$sp(InsertApiActor.scala:118) ~[analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.datastorage.worker.InsertApiActor$$anonfun$2.apply(InsertApiActor.scala:115) ~[analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.datastorage.worker.InsertApiActor$$anonfun$2.apply(InsertApiActor.scala:115) ~[analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.common.monitoring.Timer.time(Timer.scala:15) ~[analytics-common_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.datastorage.worker.InsertApiActor.com$livestream$analytics$datastorage$worker$InsertApiActor$$insertDataRowsToBigQueryTable(InsertApiActor.scala:115) [analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at com.livestream.analytics.datastorage.worker.InsertApiActor$$anonfun$receive$1.applyOrElse(InsertApiActor.scala:80) [analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:465) [akka-actor_2.11-2.3.9.jar:na]
    at com.livestream.analytics.datastorage.worker.InsertApiActor.aroundReceive(InsertApiActor.scala:54) [analytics-data-storage-worker_2.11-1.0.0.jar:1.0.0]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) …
Run Code Online (Sandbox Code Playgroud)

ssl android google-api-java-client google-api-client google-bigquery

25
推荐指数
1
解决办法
3060
查看次数

使用JavaScript从客户端浏览器上传到Google云端存储

我正在使用Google云端存储.要上传到云存储,我已经研究了不同的方法.我发现最常见的方法是将文件发送到服务器,然后将其发送到Google Cloud存储.

我想将文件直接从用户的网络浏览器移动到Google云端存储.我找不到任何与此相关的教程.我已阅读Google API Client SDK for JavaScript.

通过Google API参考,它指出可以使用HTTP请求传输文件.但我对如何使用JavaScriptAPI客户端库感到困惑.

这里的人需要共享一些代码.但我没有写任何代码,我找不到一种方法来完成这项工作.

javascript http google-api-client google-cloud-storage

25
推荐指数
1
解决办法
3373
查看次数

在片段中使用enableAutoManage()

还有其他方法可以连接Google API客户端吗?

我使用自动完成的地方,我必须在MYFRAGMENT的某些地方使用此代码

mGoogleApiClient = new GoogleApiClient.Builder(MainActivity.this)
                .addApi(Places.GEO_DATA_API)
                .enableAutoManage(this, GOOGLE_API_CLIENT_ID, this)
                .addConnectionCallbacks(this).build();
Run Code Online (Sandbox Code Playgroud)

我的问题

enableAutoManage(this, GOOGLE_API_CLIENT_ID, this)
                    .addConnectionCallbacks(this).build();
Run Code Online (Sandbox Code Playgroud)

我不能处理它,因为当我替换我时this,getActivity()我有许多铸造问题

感谢您的帮助,如果这个问题很愚蠢,我很抱歉.

android google-api-client android-fragments google-places-api

24
推荐指数
1
解决办法
2万
查看次数

是否可以通过JS客户端库为Drive使用授权时正确选择任何可用的Google帐户?

我有一个现有的支持Google Drive的应用程序正在使用Google Java客户端库和服务器流程验证.

如果您没有登录该应用程序并导航到该网址并且您已在该浏览器上登录了多个Google帐户(只有一个个人Google帐户,则其他任何一个都必须是Google商家帐户)OAuth回调优惠选择要使用的Google帐户的选项.

但是,在测试使用JavaScript客户端库的开关时,我无法使用gapi.auth.authorize激活多个帐户选择屏幕.是否可以使用JS库处理多个帐户?

更新:我尝试了immediate参数false.只要我不在弹出窗口中更改帐户,我就可以登录.如果我更改帐户,我会:

https://accounts.google.com/o/oauth2/auth?client_id=433863057149.apps.googleusercontent.com&scope=https://www.googleapis.com/auth/drive.file+https://www.googleapis. COM /认证/ drive.install + HTTPS://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile&immediate=false&redirect_uri=postmessage&origin=https:// drivedrawio. appspot.com&代理= oauth2relay593063763&RESPONSE_TYPE =令牌状态= 701344514&AUTHUSER = 1

在一个新标签中没有任何反应.我制作了一个视频来演示.

更新2:已接受针对需要双重选择多个帐户的JS客户端库的此错误.

google-account oauth-2.0 google-api-client google-drive-api

21
推荐指数
1
解决办法
9885
查看次数

GoogleApiClient onConnectionSuspended,我应该再次调用mGoogleApiClient.connect()吗?

我在服务中使用GoogleApiClient来请求融合位置更新.每件事都正常工作,但有时连接被挂起并调用onConnectionSuspended.

@Override
public void onCreate() {
    ...
    mGoogleApiClient = new GoogleApiClient.Builder(this) // this is a Context
    .addApi(LocationServices.API)
    .addConnectionCallbacks(this)  // this is a [GoogleApiClient.ConnectionCallbacks][1]
    .addOnConnectionFailedListener(this) //
    .build();

    mGoogleApiClient.connect();

    ...
}

@Override
public void onConnectionSuspended(int arg0) {

    // what should i do here ? should i call mGoogleApiClient.connect() again ? ? 

}
Run Code Online (Sandbox Code Playgroud)

在上面的链接(ConnectionCallback doc)中,它说:

应用程序应禁用需要该服务的UI组件,并等待对onConnected(Bundle)的调用以重新启用它们.

但是这个对onConnected的调用将如何发生呢?我应该再次拨打mGoogleApiClient.connect()吗?或者即使在连接暂停后,mGoogleApiClient仍将继续尝试连接?

android google-api-client google-play-services

21
推荐指数
1
解决办法
6539
查看次数

Google使用g-plus最新API登录并注销

我已经完成了一些与google plus登录和注销相关的stackoverflow问题.而且大多数都已经过时了.我无法实现我真正想要的.

退出后,下次登录时,我希望用户选择可用的Google帐户再次登录.

我正在使用自定义登录和注销按钮.签出时,我有两个案例,

  1. 如果任何用户已在同一登录活动中登录,请在登录前退出.
  2. 从不同的活动中退出.

这是我到目前为止实施的内容:

public class LoginActivity extends AppCompatActivity implements OnClickListener{

    private static final int RC_SIGN_IN = 9001;
    private GoogleApiClient mGoogleApiClient;
    private ConnectionResult mGoogleConnectionResult;
    private Button login;
    private ProgressDialog mProgressDialog;
    private Context mContext;
    private String mUri;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext= LoginActivity.this;
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.login_layout);

        login= (Button) findViewById(R.id.lg_login_btn);
        login.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if(isOnline(mContext)){
            if(v.getId()== R.id.lg_login_btn) {
                if(mGoogleApiClient!=null){
                    mGoogleApiClient.disconnect();
                }
            GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestScopes(new Scope(Scopes.PLUS_LOGIN))
            .requestEmail()
            .build();

    mGoogleApiClient = …
Run Code Online (Sandbox Code Playgroud)

android google-api-client google-plus google-plus-signin google-oauth2

20
推荐指数
1
解决办法
2868
查看次数

SecurityException:不允许启动服务Intent act = com.google.android.c2dm.intent.REGISTER

我收到错误SecurityException: Not allowed to start service Intent但看起来在搜索了很多主题后没有很好的解决方案.

请帮我,

谢谢,

p/s:

我确保使用正确,SENDER_ID因为项目编号定义Google API Console并且正确package name.

错误:

Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
            at android.app.ContextImpl.startServiceAsUser(ContextImpl.java:1785)
            at android.app.ContextImpl.startService(ContextImpl.java:1757)
            at android.content.ContextWrapper.startService(ContextWrapper.java:480)
            at com.google.android.gms.gcm.GoogleCloudMessaging.e(Unknown Source)
            at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)
            at controller.RegisterGCMClientAsync.doInBackground(RegisterGCMClientAsync.java:62)
            at controller.RegisterGCMClientAsync.doInBackground(RegisterGCMClientAsync.java:18)
            at android.os.AsyncTask$2.call(AsyncTask.java:287)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)
Run Code Online (Sandbox Code Playgroud)

Manifest.xml文件:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="app.cloudstringers" >

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" > …
Run Code Online (Sandbox Code Playgroud)

android google-api android-intent google-api-client google-cloud-messaging

19
推荐指数
2
解决办法
2万
查看次数

Chrome上的Google Auth API Javascript idpiframe初始化错误

我使用GSuite,我正在编写一个非常简单的Web应用程序来使用Google Auth API,我得到一个例外"idpiframe_initialization_failed".

现在我有谷歌示例中显示的确切HTML:https: //developers.google.com/api-client-library/javascript/samples/samples

1)我在Google Developer Console上创建了一个项目

2)我设置了OAUTH授权屏幕

3)我已经创建了客户端ID,创建了限制和重定向URL

4)我还创建了API KEY

5)最后我启用了People API,因为在设置discoveryDocs参数时发现服务失败了

通过所有这些步骤,当我调用gapi.client.init时,它仅在chrome中引发异常,我无法理解为什么.

初始化API的代码是:

    gapi.client.init({
        apiKey: 'MY_API_KEY',
        discoveryDocs: ["https://people.googleapis.com/$discovery/rest?version=v1"],
        clientId: 'MY_CLIENT_ID.apps.googleusercontent.com',
        scope: 'profile'
    }).then(function (response) {
      // Listen for sign-in state changes.
      gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);

      // Handle the initial sign-in state.
      updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
    },function(reason){
        console.log('onerror');
        console.log(reason);
      // Listen for sign-in state changes.
      gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);

      // Handle the initial sign-in state.
      updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
Run Code Online (Sandbox Code Playgroud)

代码正在运行错误块,消息是:

details: "Failed to read the 'localStorage' property from 'Window': Access is denied for this …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome google-api-java-client google-api-client

19
推荐指数
1
解决办法
3万
查看次数

在localhost上使用Google OAuth

我开始在Python和Django中使用OAuth.我需要它用于Google API.我在localhost上工作,所以我无法为url-callback注册域名.我读过Google OAuth可以与匿名域一起使用.找不到,我怎么能和在哪里做到这一点?

编辑:

我有这个观点:

def authentication(request):
    CONSUMER_KEY = 'xxxxx'
    CONSUMER_SECRET = 'xxxxx'
    SCOPES = ['https://docs.google.com/feeds/', ]

    client = gdata.docs.client.DocsClient(source='apiapp')
    oauth_callback_url = 'http://%s/get_access_token' % request.META.get('HTTP_HOST')
    request_token = client.GetOAuthToken(
      SCOPES, oauth_callback_url, CONSUMER_KEY, consumer_secret=CONSUMER_SECRET)
   domain = '127.0.0.1:8000'
   return HttpResponseRedirect(
        request_token.generate_authorization_url(google_apps_domain=domain))
Run Code Online (Sandbox Code Playgroud)

而这个错误:

抱歉,您已到达未使用Google Apps的域的登录页面.请检查网址,然后重试.

通过https://code.google.com/apis/console/注册

编辑:

CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
SCOPES = ['https://docs.google.com/feeds/', ]
DOMAIN = 'localhost:8000'


def authentication(request):    
    client = gdata.docs.client.DocsClient(source='apiapp')
    oauth_callback_url = 'http://%s/get_access_token' % DOMAIN

    request_token = client.GetOAuthToken(SCOPES,
                                     oauth_callback_url,
                                     CONSUMER_KEY,
                                     consumer_secret=CONSUMER_SECRET)

    return HttpResponseRedirect(
        request_token.generate_authorization_url())


def verify(request):
    client …
Run Code Online (Sandbox Code Playgroud)

python oauth google-api google-api-client

18
推荐指数
1
解决办法
1万
查看次数

Google Api客户端有时在onConnected中为NULL

我实施GoogleApiClient如下:

 mGoogleApiClient = new GoogleApiClient.Builder(this)
                .enableAutoManage(this, 0 /* clientId */, this)
                .addApi(LocationServices.API)
                .addApi(Places.GEO_DATA_API)
                .addConnectionCallbacks(this)
                .build();
Run Code Online (Sandbox Code Playgroud)

但在onConnected方法中我检查mGoogleApiClient => value null.在这种情况下,我尝试重新构建googleApiClient但我收到错误:

  java.lang.IllegalStateException: Already managing a GoogleApiClient with id 0
Run Code Online (Sandbox Code Playgroud)

请帮助我理解为什么mGoogleApiClient有时候是NULL,因为它已连接:|.(注意.我检查了所有源代码,我从未将GoogleApiClient设置为NULL).

谢谢!

更新

我尝试使用最新版本的播放服务后,我的问题现在解决了.

谢谢大家的帮助.

android google-api-client

18
推荐指数
3
解决办法
1万
查看次数