My question is similar to this question that did not accept an answer: Problems using node-restify-oauth2-mongodb
However, mine is a little different in that clientKeys
collection is named correctly or at least I think so.
When I go into my mongo instance and look at my collections I have:
clientkeys
users
When I look at what is in those collections I see:
> db.clientkeys.find().pretty()
{
"_id" : ObjectId("51c6e846ede91c0b8600005e"),
"clientName" : "Test Client",
"client" : "test",
"secret" : "password"
}
> db.users.find().pretty()
{
"_id" : ObjectId("543d7b974f1870f131c6d0aa"),
"name" : "Test",
"email" : "test@test.com",
"username" : "tester1",
"hashed_password" : "$2a$10$gpMXyCuILBbMF2K6Aroc7.lKoIpuGhvL98ZGGoE0tEOtYSQaCpMde",
"role" : "Admin",
"__v" : 0
}
I follow the direction in the repo: https://github.com/rgallagher27/node-restify-oauth2-mongodb
So I run this:
curl --data "name=Test&email=test@test.com&username=tester1&password=testing27&vPassword=testing27&role=Admin" http://localhost:8090/register
Which it responds how he says, like this:
{
"__v":0,
"name":"Test",
"email":"test@test.com",
"username":"tester1",
"hashed_password":"$2a$10$3uwD9IiKVlkQJvdQXqm07uQnfcXae3AGjDh.zil8.8CgtlQ2MuACK",
"_id":"520774753472d74e2c000001",
"role":"Admin"
}
Then I run the following command:
curl --user test:password --data grant_type=password --data username=tester1 --data password=testing27 http://localhost:8090/token
This however returns:
{
"error":"invalid_client",
"error_description":"Client ID and secret did not validate."
}
I can't quite figure out what I am missing. Unless I am using the wrong collection name for my clientkeys
but I don't think I am.
Thank you for any help you can provide!