moltin / js-sdk

JavaScript & Node.js SDKs for the Elastic Path Commerce Cloud eCommerce API
http://documentation.elasticpath.com/
MIT License
173 stars 77 forks source link

Access token json object format different from API /oauth/access_token #29

Closed zot24 closed 8 years ago

zot24 commented 8 years ago

First time it get the access token as the API return it

{  
  expires:1455117677,
  identifier:'client_credentials',
  expires_in:3600,
  access_token:'51af9b38492effcca99d4823b01930864c2e10',
  token_type:'Bearer'
}

However second time is pulling the access token (that haven't expire yet) from the local storage https://github.com/moltin/js-sdk/blob/master/src/moltin.coffee#L112 and it's giving it a different format

{ 
token: '51af9b38492effcca99d4823b01930864c2e10', 
expires: 1455117677000 
}
abizit commented 8 years ago

@zot24 did you find any solution for this?? I am having the same problem..

zot24 commented 8 years ago

I'm afraid the only work around atm for this is handle the access token manually or have in mind that the data could be different... anyhow I create a PR with a fix for you and see if our team can have a look review it https://github.com/moltin/js-sdk/issues/30. It may not work I'm not a Javascript expert :) so you'll need to wait until it got tested by our js team