Friday, November 11, 2016

[google-cloud-sql-discuss] Re: New Problem with login using google in OpenID Connect return Invalid Id Token that print invalid payload

What does the raw response look like before you parse out the payload? In the interest of troubleshooting, have you tested the request and response using a plain servlet instead of a form and JSP?

On Tuesday, November 8, 2016 at 2:37:32 PM UTC-5, Carl Andin Michel Sanon wrote:
Hi Adam
            Thanx for your support.
            This is the detail of my process : I have
            1- A jsp for login that contains this form
                   <form action="https://accounts.google.com/o/oauth2/auth" method="get" name="loginForm">
                        <input type="hidden" name="response_type" value="token id_token" />
                        <input type="hidden" name="client_id" value="xxxxxx.apps.googleusercontent.com" />
                        <input type="hidden" name="redirect_uri" value="http://xxxxxxxx.appspot.com/xxxx.jsp" />
                        <input type="hidden" name="scope" value="openid email" />
                        <input type="hidden" name="access_type" value="online" />
                        <input type="hidden" name="approval_prompt" value="auto" />
                        <input type="hidden" name="openid.realm" value="http://xxxxxxxxx.appspot.com/" />
                  </form>
               When we submit the form above I receive the response that contains the id_token in the page xxxx.jsp

             2-  In the page xxxxx.jsp I use this function below to retrieve the email
                  public String getEmailFromURL(String idToken){
                       System.out.println(idToken);
                       String[] jwtParts = idToken.split("\\.");
                       String payload = "";
                      JSONObject json = null;
                      payload = new String( Base64.decode(jwtParts[1].getBytes()));
                      System.out.println(payload);
                      //logger.info("Payload: "+payload);
                      //json = (JSONObject) JSONValue.parse(payload);\
                     String email = getEmail(payload);
                     if(payload!=null)
                     System.out.println(email);
                     //logger.info("Email: "+json.get("email"));   
                      return email;
                }

                 Remember that its worked very well since April 2016, but on October 22, 2016 Its not working, because the id_token is invalid. The statement "System.out.println(payload);" that's print the payload with an ? in the console of the cloud.

Best Regards.

On Monday, November 7, 2016 at 11:15:13 AM UTC-5, Carl Andin Michel Sanon wrote:
Hi Everyone,
                 We have our web application under Appengine server that's worked very well since April 2016, now users can't connect because of invalid id token from google. I try to see what change the developer from google has made, I can't see. Here is a log from google below that's print My payload finish with an "?". Someone has already found this problem?. I need your help please because users can't connect .
Best Regards.

[s~xxxxx/v1-0-4.396821290758257501].<stdout>: {"iss":"accounts.google.com","iat":1478529880,"exp":1478533480,"at_hash":"0gp2l3j9SSSI0cUDuYAJ-w","aud":"xxxxx.apps.googleusercontent.com","sub":"103993690248691064163","email_verified":true,"azp":"xxxxxxxx.apps.googleusercontent.com","hd":"xxxx.gouv.ht","email":"xxx@gmail.com"B'?

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/0edd895e-2e71-44ed-9a60-d45f47e5f373%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment