Open ahmedawad1 opened 6 years ago
@ahmedawad1 Sorry for the delay in the reply.
I'd like to look at this, so to go directly to the issue, can you share the format of your connection string that you pass to EventHubClient_CreateFromSASToken?
Please change/mangle any credentials in it (do not post the real event hub name, mangle the SHA of your token, etc.) I am only interested in the format, not the actual contents of it.
Thanks! /Dan
Hi Dan,
the SAS token that I use looks like the following: the XXX corresopnds to my service bus name and AAAA to my eventhub name,
const char* SAS_TOKEN = "SharedAccessSignature sr=sb%3a%2f%2fXXX.servicebus.windows.net%2fAAAA&sig=lXyOG%2bVWSO2PnoppT01Zx206%2bu00SWQuE4dvg1OZFL8%3d&se=1520405013&skn=RootManage";
please note also that I do not have publishers which was ok because I use the same SAS token to communicate with my eventhub in another UAMQP-SDK. For this reasons I found that some sources in the implemented library must accept publishers, I tried to trace the error I got previously and debugging till I modified the following sources (eventhubclient_ll.c , eventhubauth.c) and rebuilt the library with the modified versions. Please find them attached. After the modifications I did, it is somehow connected with the eventhub but then the connection was lost, which left me in buzzle.
For easy reaching, I modified the function "EventHubAuthCBS_SASTokenParse" in eventhubauth.c and some other functions and added log messages to understand what is happening.
Please use the compare plugin in notpad++ to see easily the differences between the modified files and the original hosted on the github.
maybe there could be a bug @ if (secondsSinceEpoch < eventHubAuth->extSASTokenExpTSInEpochSec), I think it should be greater and not less.
Please see the differences and tell me your opinion. Thanks very much again!
Similar issue is logged here : https://github.com/Azure/azure-event-hubs-c/issues/61 I have by-passed if (secondsSinceEpoch < eventHubAuth->extSASTokenExpTSInEpochSec) and got Invalid audience error. To fix this, sent decode url to cbs_put_token() which resulted in "Invalid Signature error"
Hi Everyone,
line 88 in send example, the connection string and eventhub name are used. Instead of that I want to use SAS token, so I replaced the line with the method-->
EVENTHUBCLIENT_HANDLE eventHubClientHandle = EventHubClient_CreateFromSASToken(SAS_TOKEN);
Where SAS_TOKEN argument is the const char* containing the SAS token. The code compiles and runs on my rpi but there is a parser function which couldn't fetch the parameters from the SAS_TOKEN. here is the exact error in run time:
last thing, I am sure that my SAS_TOKEN is working because i tested it in a different example SDK.
Thanks, kind regards.