ovh / node-ovh

Node.js wrapper for the OVH APIs
http://ovh.github.io/node-ovh
Other
133 stars 27 forks source link

validationUrl issue #39

Closed tiofabby closed 5 years ago

tiofabby commented 5 years ago

Hi, I am starting using node-ovh and put following code:

var ovh = require('ovh')({
  endpoint:     'ovh-eu',
  appKey:       '_removed_',
  appSecret:    '_removed_',
})

ovh.request('POST', '/auth/credential', {
    'accessRules': [
      { 'method': 'GET', 'path': '/*'},
      { 'method': 'POST', 'path': '/*'},
      { 'method': 'PUT', 'path': '/*'},
      { 'method': 'DELETE', 'path': '/*'}
    ]
  }, function (error, credential) {
    console.log('OVH: ', error || credential)
  })

This gives me:

{ validationUrl:
   'https://eu.api.ovh.com/auth/?credentialToken=_removed_',
  consumerKey: '_removed_',
  state: 'pendingValidation' }

So I go to such validationUrl, but this gives me the following error page

image

I am doing something wrong? I tried to reach same url but with my OVH account already logged in another tab (session opened) but issue is then.

I hope you guys can help. Thank you Fabrice

rbeuque74 commented 5 years ago

Hello @tiofabby; Thanks for raising an issue. It seems that your code is correct (from what I see). Can you test if you can still reproduce this bug ? If yes, can you bring this to the API mailing-list (https://github.com/ovh/node-ovh/blob/master/README.md#ovh-europe Community support) because this problem is probably not linked to node-ovh.

Thanks, Romain

tiofabby commented 5 years ago

Okay Thank you Romain, I have reached out to such mailing list then. Thanks Fabrice

julieni commented 5 years ago

On the screenshot posted on the mailing list, the URL the browser is pointing to ends with %27, an URL-encoded single quote. My guess is that @tiofabby did copy/paste that extra char by mistake in the browser.

rbeuque74 commented 5 years ago

Indeed, confirming that. Also tested the snippet on my laptop, copying the link without the final single quote is working.

Thanks all, closing this issue :) Romain

tiofabby commented 5 years ago

Hi, the link generated I clicked on does not contain the %27, extra characters. I believe these get added when being redirected to landing page. So such issue should be kept opened so this can be fixed. Workaround for now will be to remove these extra characters manually indeed. Thanks Fabrice

julieni commented 5 years ago

@tiofabby: %27 is an URL encoded single quote: ' When you click on the link from your terminal, I guess this one captures the ' at the end, for exemple your JSON snippet:

{
  validationUrl: 'https://eu.api.ovh.com/auth/?credentialToken=_removed_',
  consumerKey: '_removed_',
  state: 'pendingValidation' 
}

The URL opened by your browser is: https://eu.api.ovh.com/auth/?credentialToken=_removed_' instead of (note the last char which is the single quote) https://eu.api.ovh.com/auth/?credentialToken=_removed_

So there's really no issue here

tiofabby commented 5 years ago

Yes you are right Julien, Thank you