Skip to content

Server error #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sankarganesh1098 opened this issue Sep 12, 2016 · 17 comments
Closed

Server error #4

sankarganesh1098 opened this issue Sep 12, 2016 · 17 comments

Comments

@sankarganesh1098
Copy link

{"message":"Server error: missing client grants","code":503,"name":"server_error"}

@sheershoff
Copy link
Contributor

  1. what request do you use?
  2. do you use the postman examples collection?
  3. as far as I can see it's when you do not use Authentication header, which should always be used when addressing oauth exposed methods.

@mwohlert
Copy link

I am facing the same problem.

  1. Authorize
  2. yes
  3. I think the problem is due to the use of mongoose here:
    https://github.com/manjeshpv/node-oauth2-server-implementation/blob/master/components/oauth/mongo-models.js#L44

Since mongoose returns a mongoose Object it is not modifiable. I think .findOne(options).lean().then should be used.

But since I am basically a OAuth2.0 noob I can be totally wrong.

@MrHzAkI
Copy link

MrHzAkI commented Jan 6, 2017

Same problem here!

@evolvingfunctions
Copy link

You are on the right track. The error happens when grant object was not found or returned when the oauthClients collection is queried. Confirm your model contains a grants array similar to this:

{
    "clientId": "foo",
    "clientSecret": "bar ",
    "redirectUri": "/yourOauthRedirectUri",
    "grants": [
        "password",
        "authorization_code",
        "refresh_token"
    ]
}

@rnl2004
Copy link

rnl2004 commented Apr 30, 2017

Hey guys! Have you encountered this error?
$ curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -H "Postman-Token: c3df2fab-440f-09e4-0c5c-c9f46ef9836b" -d "username=admin&password=admin&grant_type=password&client_id=democlient&client_secret=democlientsecret" "http://localhost:3000/oauth/token"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 77 100 101 5133 6733 --:--:-- --:--:-- --:--:-- 6733{"message":"user is not defined","code":503,"name":"server_error","inner":{}}

I already updated my repo and mySQL db also but got this error.

@egachi
Copy link

egachi commented May 5, 2017

Hi, I'm getting the same error with MongoDB implementation:

{
  "statusCode": 503,
  "status": 503,
  "code": 503,
  "message": "user is not defined",
  "name": "server_error",
  "inner": {}
}

Any idea? I have double checked and the user exists in db collection.

@rnl2004
Copy link

rnl2004 commented May 5, 2017

Still waiting a feedback from the author, and i am not sure if the source code fully committed maybe they still working on it. Any updates on this?

@manjeshpv
Copy link
Owner

You can check the above commit as of now.

@rnl2004
Copy link

rnl2004 commented May 5, 2017

Hi manjeshpv, when i check the code, is this fix only uses mongodb? How about mySQL it's work when i invoked the end-point. Please verify thanks.

@rnl2004
Copy link

rnl2004 commented May 5, 2017

I appreciated your fixes in mongoDB it seems to work, but hopefully there were also a fix for mySQL database.

The output when i used mongodb else got error on mySQL:
{
"client":{
"_id":"590c6a7c23a54201484c3d19",
"client_id":"democlient",
"client_secret":"democlientsecret",
"redirect_uri":"http://localhost/cb",
"User":"590c6a7b23a54201484c3d12",
"__v":0
},
"user":{
"_id":"590c6a7b23a54201484c3d12",
"username":"admin",
"password":"admin",
"__v":0
},
"access_token":"b1185aeefc3c16004bb9c06d0f3f33ce03e0be87",
"refresh_token":"29cd6e2404c08b1a634bbb460cbd5e53b3dd1521",
"accessToken":"b1185aeefc3c16004bb9c06d0f3f33ce03e0be87",
"accessTokenExpiresAt":"2017-05-05T13:05:40.695Z",
"refreshToken":"29cd6e2404c08b1a634bbb460cbd5e53b3dd1521",
"refreshTokenExpiresAt":"2017-05-19T12:05:40.696Z"
}

@rnl2004
Copy link

rnl2004 commented May 5, 2017

Just want to share. I have a simple fixed on uses mysql db, just simply copy the implementation code in mongo models and it works! But no guarantee this fix the issue :(. Possible other function will not work. Thank you manjeshpv.

@manjeshpv
Copy link
Owner

please update error with mysql, and clone repo fresh again

@Jorger
Copy link

Jorger commented May 10, 2017

Hello, I have the same problem.

test_oath_02

In this case I connect with Mysql.

It is posible connect with LDAP with this library?

Thanks so much.

Jorge,

@rnl2004
Copy link

rnl2004 commented May 10, 2017

Jorger, please tried to add client_id and user_id foreign key value one of the table manually. Because, the oauth_demo.sql script has missing id's reference to the client and user. The create sequelize associated with that table seem not working in mysql db not sure if the issue from the associated tables. I am not familiar yet in sequelize need to learn more.

ulpsilva pushed a commit to ulpsilva/node-oauth2-server-implementation that referenced this issue Aug 8, 2017
@rahul-soshte
Copy link

rahul-soshte commented Dec 18, 2019

Also the issue can be you must have not set seedMongoDB: true or seedDB: true in the config.js file, depending on which database you are using. I did that and issue got resolved.

@Rayan20
Copy link

Rayan20 commented May 31, 2020

I have the same issue Server error: missing client grants when using redis. Any solution to this issue?

@shubham-mohit
Copy link

{
"statusCode": 500,
"status": 500,
"code": 500,
"message": "Missing parameter: headers",
"name": "invalid_argument"
} I got this error for /authorise endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests