Figma Plugin Authentication

I am trying to figure out how to create a secure login experience inside of a Figma plugin. I am currently using Firebase Authentication on my remote server which is working great. Now I would like to leverage Firebase Authentication through my Figma Plugin but I am running into roadblocks. Any help would be appreciated. I am following and I am able to make sense of some of the instructions.

I have successfully loaded my authentication page that is on my remote server by opening the remote page using (figma.showUI(<script>window.location.href = ""</script>);

I am able to go through the login flow on the remote server. After that I am stuck… How do I generate and store the unique read/write key pair? I am able to log in with Firebase and I am redirected to a predefined page that gets passed the authResult all inside the Iframe. How do I return that authResult to the figma plugin and then redirect the plugin to go into my “Plugin Dashboard”? Are there any examples of authentication inside a plugin? If anyone has successfully paired a figma plugin with Firebase Authentication or any other 3rd party auth service then can you please explain to me how to pass the access token back to the Figma plugin and then redirect to a page inside the plugin that requires authentication?

Hey, I was curious how did you solve the problem?