invana / invana-studio

Open source graph visualiser.
Apache License 2.0
174 stars 19 forks source link

CosmosDB Gremlin support #67

Closed kirk-marple closed 3 years ago

kirk-marple commented 3 years ago

First off, thanks for making this - looks like a very useful tool.

I tried to use it with Gremlin API from Microsoft CosmosDB, but couldn't figure out the authentication.

I have a wss:// URI and tried putting the 'key' from Azure portal as the token, but it wouldn't authenticate.

Anyone know how to use this with CosmosDB?

Thanks!

rrmerugu commented 3 years ago

@kirk-marple Can you point me to the documentation in Microsoft CosmosDB, that has the information about how you are trying to authenticate.

kirk-marple commented 3 years ago

I'm personally using the .NET SDK to connect, which hides a bit of it, but I found this documentation for Python:

client = client.Client('wss://.gremlin.cosmosdb.azure.com:443/','g', username="/dbs//colls/", password="")

https://docs.microsoft.com/en-us/azure/cosmos-db/create-graph-python#review-the-code

This doesn't seem to work in Graph Explorer today, given the formatting of username into the URL, I think.

rrmerugu commented 3 years ago

WebSocket API doesn't support authentication with username and password. So if you are using ws or wss protocol with graph explorer, authentication doesn't work. Authentication is supported only for http protocol by graph explorer at the moment. There is no way for me to support authentication with wss protocol as the browser itself doesn't support it in WebSocket API.

Alternatively, you can use http based gremlin api, if cosmosDB provides it. Just make sure CORS is enabled for your http based gremlin api.

kirk-marple commented 3 years ago

Thanks, I tried the HTTP API from Cosmos last night, but didn't have any luck. It's opened up to all networks (Gremlin API doesn't have explicit CORS option)

I think it must be something in the authentication, but I couldn't figure it out. Bummer, since this looks like a great tool to try.

rrmerugu commented 3 years ago

@kirk-marple there is no out of the box feature that supports authentication with websockets from browser at the moment. But I'm in the process of creating another project invana-engine which is supposed to act as a middleware that can talk to graph-explorer and your cosmosDB.

I shall update you soon on this issue. Thanks!

github-actions[bot] commented 3 years ago

Knock Knock! Anyone here! This issue might need attention.