Redirect to Socialite instead of a popup

Socialite starts with a top-level redirect. A Vue popup loses the session cookie on the way back.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/socialite-redirect-not-popup.md
Socialite starts with a top-level redirect. A Vue popup loses the session cookie on the way back.
Do not put the provider secret in a VITE variable so the popup can "start OAuth itself".
Do not add Vue Router for /auth/github/callback.
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Socialite Vue popup” open GitHub in window.open and then the callback has no session. The Socialite guide is the two routes. This page is the link.

TL;DR

  • Socialite starts with a top-level redirect.
  • A Vue popup loses the session cookie on the way back.
  • Do not put the provider secret in a VITE_ variable so the popup can “start OAuth itself”.
  • Do not add Vue Router for /auth/github/callback.

Who it's for: Laravel + Vue developers

Applies to: Laravel 13 · Vue 3

The fix#

php
public function redirect(): RedirectResponse
{
    return Socialite::driver('github')->redirect();
}

The Vue page uses a normal anchor. Inertia’s <Link> is fine when it is a GET to your own app. It is not fine as a popup.

vue
<a href="/auth/github/redirect">Continue with GitHub</a>

The callback hits Laravel, not a Vue route. Laravel writes the user and redirects home. The popup approach fails because the opener and the popup do not share the session the way people expect, and because GitHub’s page should replace the window.

What to avoid#

Gotcha

Do not put the provider secret in a VITE_ variable so the popup can “start OAuth itself”. The secret stays in .env. Do not add Vue Router for /auth/github/callback.

FAQ#

How do I redirect to Socialite instead of a popup?

Socialite starts with a top-level redirect. A Vue popup loses the session cookie on the way back.

What goes wrong with Socialite Vue popup?

Many developers open GitHub in window. Do not put the provider secret in a VITE_` variable so the popup can "start OAuth itself".

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.