0
Answered

unable to access the api

Mukesh 1 month ago updated by Vlad R 5 hours ago 15

Hi Team,

I have tried to get the call  api https://www.your-site.com/filerun/oauth2/authorize/?

With client id,client secreat,redirect uri ,grant type But getting invalid client details error message .

can some one please assist me on this.

Under review

Please paste an actual HTTP request and its server response. Without more details, we wouldn't know how to help.

Hi vlad,

Thanks for reponse and sorry for the delay.

Request is 


POST https://filerun.mydomain.com/oauth2/authorize/ HTTP/1.1 

content-type: application/json  {

 "response_type":"code", 

"client_id":"2d0129c2016533e718fd345c4497cad7",

"redirect_uri":"https://filerun.mydomain.com", 

"scope":"email",

"state":"SOME-RANDOM-DATA", }


and Response which i got is 

HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/8.5
X-Powered-By: PHP/7.4.13, ASP.NET
X-content-type-options: nosniff
X-frame-options: SAMEORIGIN
Date: Tue, 23 Nov 2021 19:19:44 GMT
Connection: close
Content-Length: 158

{
"error": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \"client_id\" parameter."
}

Is the client id "2d0129c2016533e718fd345c4497cad7" a valid one? Do you see it in the control panel of your FileRun installation?

yes vlad ,its an valid client id

Test your API call with our demo. To make sure there isn't something broken with your install.

FileRun installation URL: https://demo.filerun.co

client_id: 97914228685f9ec925f1588a72068c13

redirect_uri: http://localhost

scope: email profile

Hi vald,

Thanks for the response.


In token part 


https://filerun.mydomain.com/oauth2/token/?code=WapBTzgMXoKeeeYn491kyJXjCn5qRqX9t8Ph2qRp
&client_id=2d0129c2016533e718fd345c4497cad7&
client_secret=dsdsajdhsadhdjadadw&
redirect_uri=http://localhost&
grant_type=WapBTzgMXoKeeeYn491kyJXjCn5qRqX9t8Ph2qRp

do we have to pass same value in both code and grant type parameter?


i tried above post request but got 

check the \"grant_type\" parameter." error 

Hi Vlad,

I got error while accessing oauth2/token

https://filerun.mydomain.com/oauth2/token/?
grant_type=authorization_code&
code=uxSIO9NxAvzLZLazjJ3UnAWOqd3YMuOEASmkdRq9&
client_id=2d0129c2016533e718fd345c4497cad7&
client_secret=cZCYi6rIcS2nd0V8mN6ZHErP9wA87qqokItWJB7d&
redirect_uri=http://localhost

response

Check the \"grant_type\" parameter."}

I have passed the grant type values as authorization code 

I see you jumped to another API end-point. It must mean that you are now getting the authorization code. What changed?

Also, please keep using our demo instead of your installation, to make sure you don't have networking issues and there are no problems with your installation.

Yes Vlad, I got the authorization code 


I have tried to retrive the token using code but got the issue with grant type

Request 


https://demo.filerun.co/oauth2/token/?
grant_type=authorization_code&
code=5XToOi2qK7IzQBy9HRS5x5p1u1r3lf7u5bi9Hawi&
client_id=97914228685f9ec925f1588a72068c13&
client_secret=iCBOL3zWAcmBlvJ7H07lsAfBUOWxUpxFNmHp5Vz3&
redirect_uri=http://localhost


Response 


{"error":"invalid_request","message":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \"grant_type\" parameter."}




Hi Team,

Any update on this

Answered

Sorry, but you are just not making the correct HTTP requests. The API works as documented.

Given on the way you posted your request parameters, perhaps you are using HTTP GET, instead of HTTP POST, as the /oauth2/token/ end point required.

No vlad,

I have tried using post Method only.


POST http://filerun.myadmin.com/oauth2/token/ HTTP/1.1 

content-type: application/json {


"code": "bltAssQvSoy4LU1DsbyjLvAOq48WwYfo8sh6SBic",

"client_id": "2d0129c2016533e718fd345c4497cad7", 

"client_secret": "cZCYi6rIcS2nd0V8mN6ZHErP9wA87qqokItWJB7d", 

"redirect_uri": "http%3A%2F%2Flocalhost", 

"grant_type": "authorization_code" }


The error which i got is 

{
"error": "invalid_client",
"message": "Client authentication failed."
}

 

when i change the redirect_URI to http://localhost(without encoding) I get 

invalid_request","message":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \"grant_type\" parameter."

Even i tried with  https://demo.filerun.co but no luck 

Attaching error message