Another site is embedding my app (Laravel + Vue SPA) in an iframe. After the other site sends my app the user's information server-side, I create a JWT for that user (all server side) to be used on my site for authentication. I then pass the information back to the browser to log in the user. I've read that passing back the JWT in the URL isn't secure, so my plan is to:
- Store the JWT in my database and just send the index back to the client
- Put the key in localStorage (while in the iframe of the other site)
- Allow the user to open my site in a new window, then use the key to query my database, get the JWT and log in the user (I was having issues keeping the user logged in when opening the new window which is why I'm going through this process)
- I then refresh the JWT, delete the old JWT from my database and delete the index from localStorage.
Does this sound like a secure approach?