Using a service account to manage rise vision

  • 1
  • Question
  • Updated 2 years ago
  • Doesn't Need an Answer
Archived and Closed

This conversation is no longer open for comments or replies and is no longer visible to community members.

Hello,

Is it possible to make API calls with a Google Service account?
I am using: https://github.com/Rise-Vision/core-api-endpoints

Code I am using:

String USER = "XXX@YYY";
String SERVICEACCOUNT = "ZZZZ.apps.googleusercontent.com";


HttpTransport transport = new NetHttpTransport(); JsonFactory jsonfactory = new JacksonFactory();

GoogleCredential credential = null;

try {
credential = new GoogleCredential.Builder().
setTransport(transport).
setJsonFactory(jsonfactory).
setServiceAccountId(SERVICEACCOUNT).
setServiceAccountPrivateKeyFromP12File(
new java.io.File(RESOURCE_PK12_LOCATION))
.setServiceAccountUser(USER)
.setServiceAccountScopes( Arrays.asList(
"https://www.googleapis.com/auth/plus.login";, 
"https://www.googleapis.com/auth/plus.me"))
.build();

Core core = new Core(transport, jsonfactory, credential);

APIResponseDisplayListWrapper displays = core.display().list().execute();



USER is my username which I registered Rise Vision with. I already logged in and created a few displays.


Kind regards,
Photo of Robbert Lambrechts

Robbert Lambrechts

  • 110 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Robbert Lambrechts

Robbert Lambrechts

  • 110 Points 100 badge 2x thumb
I found it. I needed the SERVICEACCOUNT to be the @developer not the .apps
Photo of Blake Freeman

Blake Freeman, Official Rep

  • 36,116 Points 20k badge 2x thumb
Robbert,

Glad you were able to handle this. Let us know if you come across anything that you need help with!
Photo of Biagio Arobba

Biagio Arobba

  • 200 Points 100 badge 2x thumb
I'm having some issues with using a "service account" as well (in Python). Do you offer any paid support, to help with my issue?
Photo of Rakesh Allampati

Rakesh Allampati

  • 260 Points 250 badge 2x thumb
with the @developer service account it was showing the following response

com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
  "error" : "invalid_grant",
  "error_description" : "Invalid JWT Signature."
}

is there anyway out of this problem
Photo of Biagio Arobba

Biagio Arobba

  • 200 Points 100 badge 2x thumb
I'm using the Python library to do the same. I thought I had everything correct, but I am getting a 401, "User is not authorized" message.
Photo of Robb

Robb, Official Rep

  • 76,676 Points 50k badge 2x thumb
Biagio,

I would recommend going through our Developer documentation here: https://help.risevision.com/developer, and let us know if that helps.

Thanks!
Photo of Biagio Arobba

Biagio Arobba

  • 200 Points 100 badge 2x thumb
Robb, so far it doesn't help. Does RiseVision support two-legged OAuth2?
Photo of Robb

Robb, Official Rep

  • 76,676 Points 50k badge 2x thumb
Hello Biago!

Sorry for the late reply. I confirmed that our authentication is indeed OAuth2, and you may be getting this issue due to configuration issues, such as not registering the client id correctly in developer.risevision.com.

Can you confirm if you have done that?

Thanks!
Photo of Biagio Arobba

Biagio Arobba

  • 200 Points 100 badge 2x thumb
Ok, I'm dumb. My refresh token wasn't being saved.

Thank you for the follow-up, though. I really appreciate it!