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

Support FastBoot authentication #99

Closed
mikkopaderes opened this issue Jun 19, 2019 · 1 comment · Fixed by #100
Closed

Support FastBoot authentication #99

mikkopaderes opened this issue Jun 19, 2019 · 1 comment · Fixed by #100

Comments

@mikkopaderes
Copy link
Owner

Firebase auth uses JWT tokens for authentication, not cookies. JWT tokens are short live so if we pass that in to the server through cookies and verify it, there's a high chance that it's already expired.

Service workers might work although I haven't tried this solution yet.

Here's the flow of I think FastBoot auth could work:

  1. Have a service worker that intercepts fetch and modify to add the result of getIdToken()
  2. In FastBoot server, verify the token through verifyIdToken().
  3. Once the verification succeeds, we generate a custom token through createCustomToken().
  4. We then pass-in the custom token in the request header to Ember FastBoot (maybe in Authorization header?)
  5. In Ember FastBoot, we access the token through the header and use it in the ESA authenticator restore() hook. We'll be using signInWithCustomToken() to finally sign in the user.

This addon can support points 1 and 5 although I'm still contemplating if we should have 1 built-in. Points 2, 3, and 4 would have to be done in the FastBoot server which is out of our control.

@chadRoberge
Copy link

https://github.com/dockyard/ember-service-worker Is an add on I use with my projects and works well. Might be easier to implement that.

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

Successfully merging a pull request may close this issue.

2 participants