Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TerraWebhookPayload.asAuthData does not parse User #19

Open
mariomacedo opened this issue Nov 3, 2022 · 1 comment
Open

TerraWebhookPayload.asAuthData does not parse User #19

mariomacedo opened this issue Nov 3, 2022 · 1 comment

Comments

@mariomacedo
Copy link

 public void webhookSuccess(String payload) {
        WebhookHandlerUtility webhookHandler = new WebhookHandlerUtility("my-secret");
        TerraWebhookPayload parsedPayload = webhookHandler.parseWebhookPayload(payload);
        AuthData authData = parsedPayload.asAuthData().orElseGet(null);                
}

The User inside authData is always null.

Payload:

{
  "user": {
    "last_webhook_update": null,
    "provider": "GOOGLE",
    "scopes": "calendar.settings.readonly,fitness.body_temperature.read,fitness.blood_glucose.read,fitness.sleep.read,user.gender.read,fitness.location.read,fitness.blood_pressure.read,user.birthday.read,userinfo.profile,userinfo.email,fitness.nutrition.read,fitness.oxygen_saturation.read,fitness.heart_rate.read,fitness.reproductive_health.read,fitness.body.read,fitness.activity.read",
    "user_id": "aa4bc489-e466-4db3-a1cd-2b2ccf64a9b1"
  },
  "type": "auth",
  "status": "success",
  "message": "User has successfully authenticated",
  "widget_session_id": "1737787e-5aa4-479c-a2b3-8138b197a05b",
  "reference_id": "UAE-21500",
  "version": "2022-03-16"
}
<img width="446" alt="Screenshot 2022-11-03 at 17 48 02" src="https://user-images.githubusercontent.com/1006525/199856007-dd3f2432-031e-4b6b-a0fc-5a3853b7c85f.png">
@mayankagarwals
Copy link

Hi @mariomacedo 👋🏻
Thanks for opening the issue.

WebhookHandlerUtility is a utility class that handles webhook payloads received from Terra.

This is a sample repo that shows that user payload is not null for your given payload.
https://github.com/mayankagarwals/base-spring-boot-project/compare/baseWeb...terraWebHookPayload?expand=1

Could you try this out and see if the result is still the same. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants