node-ovh icon indicating copy to clipboard operation
node-ovh copied to clipboard

Access to 'GET /auth/currentCredential' route

Open bhubr opened this issue 6 years ago • 5 comments

Hi there from Toulouse ;).

I just started playing around with the Node API wrapper. I got my consumer key and validated it online. Then I wanted to access GET /auth/currentCredential route and got the following response:

{ error: 401, message: 'You must login first' }

Now I noticed that path check for setting the X-Ovh-Consumer header which obviously returns false for a request to any /auth/* route. I think that it is the culprit, as commenting out the check, for test purposes, seemed to work, and I got my expected response:

{ ovhSupport: false,
  status: 'validated',
  applicationId: 38683,
  credentialId: 116223292,
  rules: 
   [ { method: 'GET', path: '/domain/zone/*' },
     { method: 'POST', path: '/domain/zone/*' },
     { method: 'PUT', path: '/domain/zone/*' },
     { method: 'DELETE', path: '/domain/zone/*' } ],
  expiration: '2017-07-12T08:08:44+02:00',
  lastUse: null,
  creation: '2017-07-11T08:07:49+02:00' }

Checking out the code for the PHP, there doesn't seem to be such a condition for setting the Consumer and Signature headers. Shouldn't the check on path be more specific? Or am I getting something wrong?

bhubr avatar Jul 11 '17 06:07 bhubr

Yes it should indeed. If we want to be more accurate, SDKs could check the JSON specifications (https://api.ovh.com/1.0/auth.json) in order to test if route havev "noAuthentification" or not, that would be the best way to determine if the API need customer_key or not ;)

rbeuque74 avatar Jul 12 '17 21:07 rbeuque74

+1

legraphista avatar Nov 27 '17 13:11 legraphista

I made a PR for this #28

Nox-404 avatar Sep 13 '18 09:09 Nox-404

Hello, same pb...

Silbad avatar Dec 19 '20 15:12 Silbad

This i still an issue, #28 don't seems to be merged

sinux-l5d avatar Jun 06 '21 18:06 sinux-l5d