'Keeping user logged in outside of an iframe

I'm using Laravel and Vue in an SPA and am integrating my app with another app. The second app has my app in an iframe. However, once my app is loaded in their iframe and a user is authenticated, I would like the user to have the option to open my app outside of the iframe by clicking on a button. After authenticating the user on my server, my plan was to send the JWT back to the client and then log in the user with the token (this is while my app is within the other app's iframe):

await this.$store.dispatch('auth/saveToken', {
  token: token
})

If I refresh the page within the iframe, then the user is logged in, so I know that this is working.

However, when I try to open in a new tab:

let route = this.$router.resolve({ path: this.url })
 window.open(route.href)

the user is logged out.

Am I missing a step so that the user will stay logged in even if the app opens in a new tab and outside of the original iframe?



Solution 1:[1]

i think because of change browser, because iframe is different or you app is different, so you have to manage token for login if it's come on new browser, and you are not able to get token after store in vuex you need to pass in url or any other way.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Noor Fahad