OpenID not returning data from correct scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Edit: Changed my getResponseBody method to:
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 = EntityUtils.toString(resEntity); 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; }
Now I'm getting
{"user_id":"https://www.paypal.com/webapps/auth/identity/user/OWFLZYxhts-fpd5jv0kiGkM0YmJPNND9Mox_dc5KjuQ","address":{"postal_code":"95131","country":"US","state":"CA","street1":"1 Main St","street2":"","city":"San Jose"},"verified_account":"true"}]]
However, I'm still not getting age_range or account_type. Any tips?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does any news about this issue? I have the same problem with receiving account_type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Card processing with 3D secure return URL in REST APIs
- PayPal Live webscr cart API send buyer back to cancel_return url instead of return url. in PayPal Payments Standard
- Webhook validation Failed. in REST APIs
- What is the correct Auto-Return URL for Shopify? in PayPal Payments Standard
- Invalid scope error using PayPal Login in Sandbox Environment