Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OAuth integration with Vimeo using Scribe

I have been able to successfully get an access token from Vimeo using the Scribe API.

However, when I try to access a protected resource, I get an invalid signature error. My OAuthService that I use to try an access a protected resource, looks like:

OAuthService service = new ServiceBuilder()
    .provider(VimeoApi.class)
    .apiKey(APIKEY)
    .apiSecret(API_SECRET)
    .signatureType(SignatureType.QueryString)
    .build();

Then, I make a request doing the following:

  OAuthRequest orequest = new OAuthRequest(Verb.GET, "http://vimeo.com/api/rest/v2");
  orequest.addBodyParameter("method", "vimeo.videos.upload.getQuota");

This fails and tell me that the signature is invalid.

like image 999
stevebot Avatar asked Oct 24 '22 15:10

stevebot


1 Answers

The problem is,

  orequest.addBodyParameter("method", "vimeo.videos.upload.getQuota");

Scribe then added this parameter to the base string used to form the signature. Vimeo saw that I was doing a GET and that the method parameter was in the request body and not query string, so it did not include it in the base string. Hence, the signature Vimeo expected was different than the one Scribe generated.

I am doing a GET however so I should be passing this parameter on the query string,

  orequest.addQuerystringParameter("method", "vimeo.videos.upload.getQuota");

This works, as would:

  OAuthRequest orequest = new OAuthRequest(Verb.POST, "http://vimeo.com/api/rest/v2");
  orequest.addBodyParameter("method", "vimeo.videos.upload.getQuota");
like image 175
stevebot Avatar answered Nov 15 '22 00:11

stevebot