loopback icon indicating copy to clipboard operation
loopback copied to clipboard

new CustomModel based on access-token model with different primary key.

Open evgen-volk opened this issue 9 years ago • 5 comments

Description/Steps to reproduce

if create CustomModel based on AccessToken and set field "pk" as id field like this: { "name": "CustomModel", "plural": "accessTokens", "base": "AccessToken", "idInjection": true, properties": { "pk": { "type": "string", "id": true } }, then when user try to login, in function that creates new Token receive err:

In access-token.js : AccessToken.createAccessTokenId(function(err, id) { if (err) return next(err); ctx.instance.id = id; next(); }); });

Expected result

ctx.instance.pk - in ctx.

node_modules/loopback/common/models/access-token.js:76 ctx.instance.id = id; ^ TypeError: Cannot set property id of # which has only a getter

Additional information

darwin x64 8.1.2 ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected]

evgen-volk avatar Jul 04 '17 20:07 evgen-volk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 02 '17 20:09 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Sep 16 '17 20:09 stale[bot]

How did you resolve this issue?

elimcjah avatar Aug 28 '18 19:08 elimcjah

I haven't remembered already. Think, just removed pk field and start using id field as default. Sorry. (

evgen-volk avatar Aug 29 '18 07:08 evgen-volk

how access token work

eliaskibret avatar Oct 26 '19 14:10 eliaskibret