Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models are not attaching to the db #57

Closed
1 of 2 tasks
remotevision opened this issue Jan 19, 2017 · 3 comments
Closed
1 of 2 tasks

Models are not attaching to the db #57

remotevision opened this issue Jan 19, 2017 · 3 comments

Comments

@remotevision
Copy link

remotevision commented Jan 19, 2017

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

When setting up an OAuth2 server, it appears the models are not being attached to the db. I have tried this a few different ways, including adding it to the model-config.json

  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models",
      "./node_modules/loopback-component-oauth2/lib/models",
      "./node_modules/loopback-component-passport/lib/models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "loopback/server/mixins",
      "../common/mixins",
      "./mixins"
    ]
  },

Link to sample repo to reproduce issue (if bug)

I created a gist that shows all of the relevant code and configurations.
https://gist.github.com/remotevision/9bd478e08ce97929c69527dcff4e6a0d

Actual result (if bug)

a trace of the models.

$ DEBUG=loopback:oauth2 node .
------------------------------------------------
[sample-data]: Initializing
[sample-data]: create users 1
[sample-data]: create applications 1
Client application registered: id=123 name=test-app key=secret
User registered: id=1 username=bob password=secret
------------------------------------------------
[oAuth]: Initialized
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
  loopback:oauth2 model: +0ms User
  loopback:oauth2 model: +0ms Application
  loopback:oauth2 model: +1ms AccessToken
  loopback:oauth2 model: +0ms ACL
  loopback:oauth2 model: +0ms RoleMapping
  loopback:oauth2 model: +0ms Role
  loopback:oauth2 clientLogin: bob +0ms
  loopback:oauth2 clientSecret: secret +0ms

Additional information (Node.js version, LoopBack version, etc)

I am using,

  • Loopback 3.0.0
  • npm 3.10.3
  • node 6.5.0
@remotevision
Copy link
Author

Not a bug. This was fixed by removing the component config from oauth.js and adding it to the component-config.json

 // component-config.json
  "loopback-component-oauth2": {
    "dataSource": "db"
  }

@juaneduardodelgado
Copy link

hi @remotevision,

Do you mind sharing the sources to see how you configured the component. I have been trying to follow your steps but I can't make it work, always got an authorized.

I think I'm missing the Application entry as I haven't been able to use your sample-data.json. I have been trying with a seed script in the boot folder, but I can't find the model to insert the App entry (I just started playing with loopback 2 days ago).

Thanks

@remotevision
Copy link
Author

@juaneduardodelgado yes, I'll create a standalone project and put it on github. you should know that I only needed it for clientCredentials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants