How to get access token from GoogleCredential?

后端 未结 2 1279
感情败类
感情败类 2020-12-08 04:38

I am trying to get an access token to use the Google Play Android Developer API, and I got this far using the Google API Java Client documentation example:

H         


        
2条回答
  •  死守一世寂寞
    2020-12-08 05:39

    Got it. You have to call credential.refreshToken() before credential.getAccessToken(). It doesn't say this anywhere in the documentation but that's what does it.

    credential.refreshToken();
    accessToken = credential.getAccessToken();
    

提交回复
热议问题