me icon indicating copy to clipboard operation
me copied to clipboard

posts/firebase-authentication-service-worker/

Open utterances-bot opened this issue 4 years ago • 4 comments

Authentication with Firebase Authentication in Service Worker | miyauci.me

Introduce how to use Firebase Authentication in Service Worker. It will also explain messaging with Service Worker and show how to share user IDs with Service Worker.

https://miyauchi.dev/posts/firebase-authentication-service-worker/?utterances=d41191807da7189e42e02865DvcGDuhsGlTxsDXTaPAKLDrarJrrvepQzi0iASPxTHr9dUdrzuhP2De51PuAvRRJbVYyGqbuuEYbZd7Y4DkgY0ncf44CvHAdQ1VLJk1TDzKRV3TjWxf9EXrMI6c%3D#build-the-service-worker

utterances-bot avatar Nov 28 '21 21:11 utterances-bot

Appreciate the article, do you have any links to source? I couldn't find anything on your github

mfreeman451 avatar Nov 28 '21 21:11 mfreeman451

@leku451 Have a look at the following. https://github.com/TomokiMiyauci/me/blob/main/posts/firebase-authentication-service-worker/index.mdx

TomokiMiyauci avatar Nov 29 '21 02:11 TomokiMiyauci

Tomoki-San, thank you for your reply. I meant that it seems your examples are incomplete.. is there a github repo or project where you have actually implemented this stuff?

mfreeman451 avatar Nov 30 '21 02:11 mfreeman451

@leku451 Thank you for your comment. I use it on this blog.

https://github.com/TomokiMiyauci/me/blob/main/src/workers/fetch.ts#L18

After bundling the service worker script above, I inserted it into gatsby-plugin-offline to use it.

https://github.com/TomokiMiyauci/me/blob/main/config/gatsby-plugins.ts#L277

The gatsby-plugin-offline contains a script to activate the service worker. Also, the uid exchange is done as follows https://github.com/TomokiMiyauci/me/blob/main/src/workers/message.ts#L7 https://github.com/TomokiMiyauci/me/blob/27b72c97c887ae65bab4e3d9ef99e7853e4ca8b3/src/hooks/user.ts#L25

If you have any other questions, ask me.

TomokiMiyauci avatar Nov 30 '21 04:11 TomokiMiyauci