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 8889567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:17:35+00:00 2026-06-14T22:17:35+00:00

I am not very familiar with programming with requests so I’m going to try

  • 0

I am not very familiar with programming with requests so I’m going to try to be as concise and I possibly can in describing my problem.

I am trying to get an authentication token which I can use to get a Google account’s userinfo.
I succeeded in getting the token in this form: https://oauth2-login-demo.appspot.com/oauthcallback#access_token={accesstoken}&token_type=Bearer&expires_in=3600

Then I followed this tutorial’s TODO#11: http://www.sw-engineering-candies.com/blog-1/howtogetuserinformationwithoauth2inagwtandgoogleappenginejavaapplication

@Override
public LoginInfo loginDetails(final String token) {
    String url = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=" 
        + token;

    final StringBuffer r = new StringBuffer();
    try {
        final URL u = new URL(url);
        final URLConnection uc = u.openConnection();
        final int end = 1000;
        InputStreamReader isr = null;
        BufferedReader br = null;
        try {
            isr = new InputStreamReader(uc.getInputStream());
            br = new BufferedReader(isr);
            final int chk = 0;
            while ((url = br.readLine()) != null) {
                if ((chk >= 0) && ((chk < end))) {
                    r.append(url).append('\n');
                }
            }
        } catch (final java.net.ConnectException cex) {
            r.append(cex.getMessage());
        } catch (final Exception ex) {
            log.log(Level.SEVERE, ex.getMessage());
        } finally {
            try {
                br.close();
            } catch (final Exception ex) {
                log.log(Level.SEVERE, ex.getMessage());
            }
        }
    } catch (final Exception e) {
        log.log(Level.SEVERE, e.getMessage());
    }

    final LoginInfo loginInfo = new LoginInfo();
    try {
        final JsonFactory f = new JsonFactory();
        JsonParser jp;
        jp = f.createJsonParser(r.toString());
        jp.nextToken();
        while (jp.nextToken() != JsonToken.END_OBJECT) {
            final String fieldname = jp.getCurrentName();
            jp.nextToken();
            if ("picture".equals(fieldname)) {
                loginInfo.setPictureUrl(jp.getText());
            } else if ("name".equals(fieldname)) {
                loginInfo.setName(jp.getText());
            } else if ("email".equals(fieldname)) {
                loginInfo.setEmailAddress(jp.getText());
            }
        }
    } catch (final JsonParseException e) {
        log.log(Level.SEVERE, e.getMessage());
    } catch (final IOException e) {
        log.log(Level.SEVERE, e.getMessage());
    }
    return loginInfo;
}

When that code is run, I am catching an error:

WARNING: Authentication error: Unable to respond to any of these challenges: {googlelogin=WWW-Authenticate: GoogleLogin realm="https://www.google.com/accounts/ClientLogin", service="lso"}
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

I am running in development mode in GWT. I also tried deploying and running, but it also caught some error.

Some possible causes could be:
1) my token timed out (but I Just got it)
2) I must deploy first?
3) I’m not doing the steps properly? (after i get the token, I have to validate it first? how do i do that?)

I am not quite sure how to proceed from here. Hoping to get some help from the community.

  • 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-14T22:17:36+00:00Added an answer on June 14, 2026 at 10:17 pm

    It was a string concatenation error. The variable wasn’t holding a valid token.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have not used jquery much yet and not very familiar with it. Trying
I am not very familiar with powershell scripting and I'm stuck on this problem
i'm not very familiar with the memory management in Objective-C but i try my
I'm not very familiar with FoxPro and I'm running into problems trying to modify
I'm not very familiar with file handling in ruby. A problem I've come accross
I'm not very familiar with C++ programming. I know the basics of programming in
I'm not very familiar in programming databases, but I have a Mysql-Database which I
I'm very new to Django and not super familiar with web programming in general,
i'm really not very familiar with CSS and HTMl so take it easy with
I am not very familiar with the way of creating a daemon in Python,

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.