keithwhor / nodal

API Services Made Easy With Node.js

Home Page:http://www.nodaljs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AcessToken.verify is not working

dpmango opened this issue · comments

Hey!
Im following the video guide pt.3 and spend some time figuring out why destroying access token return Your access token is invalid. no matter how hard I try.

I have used following DELETE request and token was valid and have all user attributes.
http://localhost:3000/api/access_tokens/1/?access_token=xxxxxxx

After going a bit deeper into code and loging params I found out that verify method gets undefined on logging into console params.auth.access_token

static verify(params, callback) {
    this.query()
      .join('user')
      .where({
         access_token: params.auth.access_token,
         expires_at__gte: new Date()
       })
     .........

Instead I managed my issue with modified params.body.access_token and therefore passing access_token as param.

      .where({
        access_token: params.body.access_token,
        expires_at__gte: new Date()
      })

Something to do with params.auth ?