Vonage / vonage-dotnet-sdk

Vonage REST API client for .NET, written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com/
Apache License 2.0
106 stars 86 forks source link

Vonage Video Session Monitoring #578

Closed jcharro1979 closed 5 months ago

jcharro1979 commented 6 months ago

In Vonage Video session monitoring, it is necessary to identify the source of events. According to the documentation at https://developer.vonage.com/en/video/guides/session-monitoring#connection-created, information is expected to be provided in the 'data' property, as described in https://developer.vonage.com/en/video/guides/create-token#connection-data. For example, userId should be included. However, in our tests, the 'data' property always arrives empty.

Expected behaviour The userId or any other claims passed during token creation should be received in the events, allowing the backend to identify where the event occurs.

Token with new userId claim image

connectionCreated event with data property empty. image

Tr00d commented 6 months ago

Hi @jcharro1979,

Thanks for letting me know. I'll have a look and get back to you asap.

Tr00d commented 5 months ago

@jcharro1979,

So, the problem is you used a userId key to set your value. There's no explicit link between userId and data. If you want to pass that information to the callback response, you need to assign the userId to a connection_data claim in the token.

For example:

{
   "iat": xxx,
   "applicatoinId": xxx,
   "jti": xxx,
   "role": xxx,
   "session_id": xxx,
   "scope": xxx,
   "connection_data": {yourUserId},
}

Can you give it a try and let me know?

jcharro1979 commented 5 months ago

Hello @Tr00d:

Thank you very much for your response, I have completed tests and I already obtain the user information in the callback event.

image

image

However, I think that the documentation should be updated, since this claim connection_data is not specified.

Thank you very much

Greetings

Tr00d commented 5 months ago

@jcharro1979,

Absolutely, I went through the same struggle you did so I asked the documentation to be improved. Also, I think I'll try to make this obvious (as a feature) in the SDK as well.