quasarframework / app-extension-feathersjs

[WIP] The official Quasar 1.0 App-Extension for feathersjs
https://quasar.dev
MIT License
6 stars 4 forks source link

Add an auth API that can be used on modal dialogs #6

Closed MichaelJCole closed 5 years ago

MichaelJCole commented 5 years ago

Hi, this PR creates a client API for authentication. I wanted something that could work in modal dialogs instead of on page routes.

If you like this PR, I can move forward to integrate it. In the interest of not bundling server code into the client, I'd recommend the feathers server code move down next to /src, like this:

/src/...
/src-pwa/...
/src-electron/...
/src-feathers/...

The API is patterned after the Meteor Accounts API which was one of the best things about Meteor. It included ways to customize welcome/lost password/etc emails and a standard user interface that could be customized and OAuth packages that could be mixed in. I loved having auth done on the first day of a project - and that would be a killer feature for Quasar if it could do that with Firebase and Feathers.


Client Template:

quasarAuthApi/src/boot/feathersAuth.js includes some notes I created in case I ever had to think through it again. store/index/js references an api/stuff service. That nameStyle: 'short' setting kicked my ass for almost 2 days before I figured it out. lib/feathersClient.js is called by store.


Server Template:

I added a server with a stuff service for working with the auth client. I also added a config/default.json and dependencies so it'll start with node src

src/app.js is the Express server

I added two middlewares that might be interesting:

src/middleware/whitelist.js hides behind Cloudflare. It's configured in config/*.json src/middleware/serveWebApp.js serves a Quasar app with appropriate headers for security and caching behind Cloudflare.

To deploy:

1) Build the Quasar app and copy to Feathers /public 2) Git commit Quasar app into Feathers repo 3) Package Feathers App in Docker container 4) Deploy Feathers App behind Cloudflare (or other CDN)

nothingismagick commented 5 years ago

I'll merge this, but can you add some documentation to the readme next?

MichaelJCole commented 5 years ago

Hi Dan, yes. I'll be working on this in the upcoming week.