Google Apps Profiles API: java.lang.NullPointerException: No authentication header information

我只是一个虾纸丫 提交于 2019-12-05 19:40:26

I found a reason why service.setOAuth2Credentials() doesn't work with building new Google Credential (build with P12File).

It is because service.setOAuth2Credentials() doesn't REFRESH TOKEN internally like the other services in Google Sites, Google Drive and etc...

If you build Google Credential with P12File, just add this line after building the Google Credential.

googleCredential.refreshToken();

I guess it is a bug for ContactsService.setOAuth2Credentials().

I had this problem while using SecureSociale for the authentification.

In my case, the issue was related to the scope defined in the configuration of SecureSociale.

Don't forget to check that your are using the right scope for the given token.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!