Implementing Withings api in android

531 Views Asked by At

I am trying to implement the withings api in android. Able to do the authentication part through "google auth" implementation but not able to access the api as "oauth_nonce" is unknown and I have no idea how to generated it. If you know the process then please do share and if you have implemented withings api using any method then please do share.

1

There are 1 best solutions below

0
Jowy On

The oauth_nonce is a random string and it must be unique.

I'm developing an hybrid app so my code to generate the oauth_nonce in AngularJS is :

.factory('RandomFactory', function() {
  return ({
    string: function(length, chars) {
      var result = '';
      for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
      return result;
    }
  })

var oauth_nonce = RandomFactory.string(32, "1234567890qwertyuiopasdfghjklzxcvbnm");

But I think you can easily do the same in Java.