Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8110853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:54:23+00:00 2026-06-06T01:54:23+00:00

Good pic by Tim Rosenberg that shows exactly how OAUTH2 work’s: I’m kind a

  • 0

Good pic by Tim Rosenberg that shows exactly how OAUTH2 work’s:

enter image description here

I’m kind a lazy to even start looking on this 2 files and test
so I searched for easyest way to

1.get token

2.access with that token

with help of gwt-oauth2

put it into index.php head :
<script type="text/javascript" src="gwt-oauth2.js"></script>

and this in body

<script type="text/javascript">
(function() {
var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/auth";
var GOOGLE_CLIENT_ID = "CLIENT_ID";
//var PLUS_ME_SCOPE = "https://www.googleapis.com/auth/plus.me";
//var FusionTable_SCOPE = "https://www.googleapis.com/auth/fusiontables";       
var button = document.createElement("button");
button.innerText = "Authenticate with Google";
button.onclick = function() {

var req = {
    'authUrl' : GOOGLE_AUTH_URL,
    'clientId' : GOOGLE_CLIENT_ID,
    'scopes': ['https://www.googleapis.com/auth/plus.me',
               'https://www.googleapis.com/auth/fusiontables'
              ],
};

oauth2.login(req, function(token) {
    alert('Got an OAuth token:\n'+ token +'\n'+ 'Token expires in '+ oauth2.expiresIn(req) +' ms\n');
  }, function(error) {
    alert("Error:\n" + error);
  });
};

var dv = document.getElementById('admin-content');
dv.appendChild(button);
var clearTokens = document.createElement('button');
clearTokens.innerText = 'Clear all tokens'
clearTokens.onclick = oauth2.clearAllTokens;
dv.appendChild(clearTokens);
})();
</script>

OK,

Now you can see connection and redirection to oauthWindow.html in new window without errors. GET parameters now showing you access_token token_type expires_in. Check the access_token HERE

As you see access_token working great BUT

What you still don’t get is first alert from that :

oauth2.login(req, function(token) {
  alert('Got an OAuth token:\n' + token + '\n'
  + 'Token expires in ' + oauth2.expiresIn(req) + ' ms\n');
}, function(error) {
  alert("Error:\n" + error);
});

Second alert works fine and when you try to Auth. again if oauthWindow.html still open it shows you an error alert(so it’s working!)
Now let’s add that little code to oauthWindow.html

<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript">
      if (window.opener && window.opener.oauth2 && window.opener.oauth2.__doLogin) {
        window.opener.oauth2.__doLogin(location.hash);
      } else {
        document.body.innerText = "Your browser seems to be stopping this window from communicating with the main window.";
      }
    </script>
  </head>
  <body></body>
</html>

Perfect!

Now if you want to work with private tables all you need is to add an access_token to url.

Thanks for giving me the reason to answer myself!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:54:24+00:00Added an answer on June 6, 2026 at 1:54 am

    Put this into oauthWindow.html file

    <!DOCTYPE html>
    <html>
      <head>
        <script type="text/javascript">
          if (window.opener && window.opener.oauth2 && window.opener.oauth2.__doLogin) {
            window.opener.oauth2.__doLogin(location.hash);
          } else {
            document.body.innerText = "Your browser seems to be stopping this window from communicating with the main window.";
          }
        </script>
      </head>
      <body></body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a good css technique to use nav tabs that look exactly
I am looking for a good C compiler for the PIC 16 family, working
Good day, I have a class that implements the LoaderCallbacks, and hence have the
Good morning, I am currently developing a java web application that exposes a web
Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Good day, Stack Overflow. I have a homework assignment that I'm working on this
Good-day, I'm experiencing a very strange event that just started happening. Whenever I press
I am trying to refactor my code so that it follows good OO pattern,
I found something related here but did not give me a good start Since
Good morning, I have mysql queries where I would like to calculate percentage of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.