Cannot call AccessToken.findById() in loopback-example-passport

1,091 views
Skip to first unread message

Matthew Woolnough

unread,
Sep 15, 2014, 8:15:09 AM9/15/14
to loopb...@googlegroups.com
I cloned the Git from scratch & installed the dependancies. I then configured Google as an OAuth provider & authenticated a user.

Then using the returned token attempt to get users.

The following error is thrown:

Error: Cannot call AccessToken.findById(). The findById method has not been setup. The PersistedModel has not been correctly attached to a DataSource!
    at throwNotAttached (/Source/loopback/loopback-example-passport/node_modules/loopback/lib/models/persisted-model.js:56:9)
    at Function.find [as findById] (/Source/loopback/loopback-example-passport/node_modules/loopback/lib/models/persisted-model.js:139:3)
    at Function.AccessToken.findForRequest (/Source/loopback/loopback-example-passport/node_modules/loopback/lib/models/access-token.js:126:10)
    at /Source/loopback/loopback-example-passport/node_modules/loopback/lib/middleware/token.js:53:16
    at Layer.handle [as handle_request] (/Source/loopback/loopback-example-passport/node_modules/loopback/node_modules/express/lib/router/layer.js:76:5)
    at trim_prefix (/Source/loopback/loopback-example-passport/node_modules/loopback/node_modules/express/lib/router/index.js:263:13)
    at /Source/loopback/loopback-example-passport/node_modules/loopback/node_modules/express/lib/router/index.js:230:9
    at Function.proto.process_params (/Source/loopback/loopback-example-passport/node_modules/loopback/node_modules/express/lib/router/index.js:305:12)
    at /Source/loopback/loopback-example-passport/node_modules/loopback/node_modules/express/lib/router/index.js:221:12
    at Function.match_layer (/Source/loopback/loopback-example-passport/node_modules/loopback/node_modules/express/lib/router/index.js:288:3)

Is there a missing relation?


matthew 

Raymond Feng

unread,
Sep 15, 2014, 11:35:13 AM9/15/14
to Matthew Woolnough, loopb...@googlegroups.com
Good catch. I just fixed it.


Thanks,

---
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.

StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages