shlomiassaf / resty-stone

Rest API toolkit for KeystoneJS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auth API

jjhesk opened this issue · comments

Do we need to add empty folder for routes/api/auth/login.js and routes/api/auth/logout.js as I followed the instruction in the example.

because I have received empty data set
{
"success": false,
"resultType": "notSet",
"modelType": "notSet",
"error": "Not Found"
}

No,

There is no need to create a special folder, these are not resources, they are basically authentication RPC`s

It will be better if you provide more information with each issue (which are appreciated).
This is for me to better understand the situation.

Are you calling the right endpoint?
Auth middleware is the first one the plugin registers. (if we put aside proxy of cookie as session...)
I dont think there is anything that can block it.
You better check the endpoint and validate against

keystone.set('resty api base address', "/api"); // or any value set here

According to my settings:

keystone.set('resty api base address', "/api"); // you can omit this line, it is the same as the default and here for demo only.
keystone.set('resty meta location', "./routes/api"); // provide the relative path from your project's root, to your Resource metadata folder.
keystone.set('resty auth type', restyStone.AUTH_TYPE.TOKEN); // keep KeystoneJS cookie based session for auth (use in dev only!)
keystone.set('resty token header', "api-token");

keystone.start(restyStone.start());
keystone.init({

    'name': 'xxxxxx',
    'brand': 'xxxxx',

    'less': 'public',
    'static': 'public',
    'favicon': 'public/favicon.ico',
    'views': 'templates/views',
    'view engine': 'jade',

    'emails': 'templates/emails',

    'auto update': true,
    'session': true,
    'auth': true,
    'user model': 'User',
    'cookie secret': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

});

I could finally tested out by using POST only on 54.64.185.163:3000/api/auth/login