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

314
Views
Gmail API : Extract "code" param from the URL of a pop-up window to get the access_token details

Iam trying to authenticate gmail using OAuth2 for my web application. From the server, we return a url to the client, which then uses that to open a pop-up. The code is as shown:

        var win = window.open(data.google_oauth_url, `<h1>Gmail</h1>`, 'width=800, height=600');
          var pollTimer = setInterval(() => { 
              try {
                  const searchParams = new URL(win.document.URL).searchParams
                  console.log("url is",win.document.URL, searchParams, searchParams.get("code"))
                  if (searchParams.get("code") != -1) {
                      clearInterval(pollTimer);
                      win.close();
                  }
              } catch(e) {
                console.log("Error",e)
              }
          }, 500);

From the pop-up , i want to extract the "code" param which google returns to us after the authentication is completed. But when i try to extract the param from the client side, iam facing an error :

Uncaught DOMException: Blocked a frame with origin "https://xyz" from accessing a cross-origin frame

Is anyone aware of a solution for this, or any other ways of extracting the "code" param so i can proceed to get the access_token details. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
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!