Wednesday 3 May 2017

Unable to Redeem the code for access tokens for ondrive

I am trying to access onedrive api authentication through its oauth api, I am following there docs https://dev.onedrive.com/auth/msa_oauth.htm

there they want to hit the same url for code and access_token by GET and POST method, and as per there docs i have done same thing but it always keep saying error=invalid_request&error_description=The+provided+request+must+include+a+\'client_id\'+input+parameter.

Here is my request dump

{ request: 

 { debugId: 1,

     uri: 'https://login.live.com/oauth20_authorize.srf',

     method: 'PUT',

     headers: 

      { host: 'login.live.com',

        'content-type': 'application/x-www-form-urlencoded',

        'content-length': 219 },

     body: 'code=code&grant_type=authorization_code&client_id=id&client_secret=secret&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Ftoken%2Fonedrive' } }

and its response

{ response: 
   { debugId: 1,
     headers: 
      { 'cache-control': 'no-cache',
        pragma: 'no-cache',
        'content-length': '0',
        'content-type': 'text/html; charset=utf-8',
        expires: 'Wed, 03 May 2017 16:23:37 GMT',
        location: 'https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+request+must+include+a+\'client_id\'+input+parameter.',
        server: 'Microsoft-IIS/8.5',
        p3p: 'CP="DSP CUR OTPi IND OTRi ONL FIN"',
        'set-cookie': [Object],
        'x-wlid-error': '0x80049D58',
        'x-content-type-options': 'nosniff',
        'strict-transport-security': 'max-age=31536000',
        'x-xss-protection': '1; mode=block',
        date: 'Wed, 03 May 2017 16:24:37 GMT',
        connection: 'close' },
     statusCode: 302,
     body: '' } }

I am using Nodejs request module also tried it with axios but no progress but if i try this with postmen then it works. `



via Samundra Khatri

No comments:

Post a Comment