cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Contributor

OpenID not returning data from correct scope

Hey guys,

 

I'm trying to get Paypal Attributes and Address from the OpenID API in the Sandbox environment. My PayPal button is as follows:

 

paypal.use( ['login'], function (login) {
						  login.render ({
							"appid": clientid,
							"authend": authend,
							"scopes":"openid https://uri.paypal.com/services/paypalattributes address",
							"containerid":"lippButton",
							"locale":"en-us",
							"returnurl":root+ "PayPalServlet"
						  });

Permissions are properly granted in the popup and my servlet correctly generates a Bearer token and makes the request to "/v1/oauth2/token/userinfo?schema=openid". It looks like everything should be working, but my response body is always limited to the following attributes:

 

{"user_id":"https://www.paypal.com/webapps/auth/identity/user/OWFLZYxhts-fpd5jv0kiGkM0YmJPNND9Mox_dc5KjuQ","address":{"street1":"1 Main St","street2":""}}]]

I don't get any error messages. 

 

I'm wondering why my response body has brackets at the end and why the rest of the address attributes and the PayPal Attributes are not being returned.

 

I'm using Apache's HTTPGet to make the request and CloseableHttpResponse to get the results on my Java Glassfish backend. I extract the response body with the following method:

 

private static JsonObject GetResponseBody(CloseableHttpResponse httpResponse){
        if (httpResponse != null) {
            HttpEntity resEntity = httpResponse.getEntity();
            JsonObject responseObj = null;
            if (resEntity != null) {
                try {
                    InputStream is = resEntity.getContent();
                    String responseStr = IOUtils.toString(is, "UTF-8");
                    System.out.println(responseStr);
                    is.close();
                    if (responseStr != null && !responseStr.isEmpty()) {
                        JsonParser parser = new JsonParser();
                        responseObj = parser.parse(responseStr).getAsJsonObject();
                    }
                } catch (IOException e) {
                    Logger.getLogger(PayPalHandler.class.getName()).log(Level.SEVERE, null, e);
                }
            }
            return responseObj;
        }
        return null;
    }

 

Thanks in advance.

Who Me Too'd this topic