Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

370
Views
How can I redirect the parent page after OAuth 2 flow is complete?

My current flow is such:

  1. User clicks login to third party
  2. Upon grant, the third party redirects to configured redirect uri with code
  3. Forward code to backend to verify, etc.
  4. Return success/failure

My frontend is coded to close the popup when the login is successful, but the parent page still just remains the same - standard login page. The goal would be to redirect that page.

I've tried to add an event listener on the window object, but it's not working.

...
  const loginWindow = window.open(oAuthUrl,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height=450')
  loginWindow.onbeforeunload = function () {
    alert("new window closed");
  }
};

Is this possible?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ok, I have something that seems to be working:

        fetch('http://localhost:8080/user/login', requestOptions)
            .then(response => response.json())
            .then(data => window.close())
            .then(data => window.opener.location.replace("/"))
    }

window.opener allows you to access the parent window.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!