How to send access token using a wss .net client - nest-api

I want to connect to the nest endpoint using a .net wss client.
I am unsure how to pass the NEST access_token during handshake to the endpoint to complete
the authorization handshake.
Without it I get a 401.
If I put is as query parameter "/devices.json?auth=c.Uysdi..." I get
a 307 (redirection) to a firebase endpoint but with https ??? (no
longer wss).
If i add the access token to headers I get 401.
In the api samples I can only find javascript examples using firebase client lib which
does not help much.
Can someone explain what should I do to complete the wss handshake ?

I replaced the https with wss. that worked for me.
Maybe a bit of code will help people solve you issue

I found out what was the problem.
There was a 'bug' in the web socket library I was using. The header value "Upgrade: websocket"
which is passed during websocket handshake was passed like this "Upgrade: webSocket".
Some websocket test servers are case insensitive but not the one from Google Nest.
Once I changed this to "websocket" I got a proper websocket handshake response and no redirection either.
Access token is added as a query parameter when connecting with websockets to the nest endpoint.
Once the connection is established I am again in the dark on how to establish subscribtion to certain
events or query data but this will be the topic for another question.

Related

GraphQL subscription does not receive messages after successful handshake

I have created a simple GraphQL Subscription using Nest.js/Apollo GraphQL over Node.js. My client application which is a react.js/apollo client works find with the server. The client subscibes to the server via GraphQL similar to:
subscription
{
studentAdded
{
id
}
}
My problem is that it works only locally. When I deploy my server back-end to a hosted docker over internet, client won't receive data anymore.
I have traced the client, it sends GET request on ws://api.example.com:8010/graphql and receives the successful HTTP/1.1 101 Switching Protocols response. However, nothing is received from server like when the server was on my local machine. Checking the remote server log showed me that the client successfully connects to server. There, I can see onConnect log messages.
Now I need any guidance to solve the problem.
I check several things myself. Firstly, I thought WebSocket address is prohibited in the network but then realized that it is on same port as normal HTTP. Secondly, supposed that WebSocket messages/frames are transmitted over UDP but I was not correct, it is over TCP and no need to worry about network settings.
Additionally I have read several github threads and StackOverflow questions. But did not find any clue. I am not directly using Node.js/WebSocket, instead, I am using Nest.js/GraphqQL subscription. It has made my search tougher.
Your help is highly appreciated.

How to tell if a TLS server requested a client certificate

I'm making TLS client connections in Node.js. Some servers I communicate with request a client certificate. I'd like to be able to detect when this has been requested, so I can log it. At the protocol level I believe this is sent along with the TLS server hello, so the data is there, but I'm not sure how I can get at it.
I'm never actually providing a client certificate for now, I'm just aiming to report which servers requested one.
I think there's probably two cases here:
A cert has been requested, not provided, and the server has accepted the connection anyway (and then probably given my some kind of 'not authenticated' response).
A cert has been requested, not provided, and the server has rejected the TLS connection entirely.
At the moment I can't detect either case, solutions for either or both very welcome.

Docusign Connection issue

We are using the Docusign Rest API to integrate with our application to send documents for signing.
The below mentioned is the connection string that is formed during runtime
Connection String =
weblogic.net.http.SOAPHttpsURLConnection:https://demo.docusign.net/restapi/v2/login_information
When we try to get response from the connection, we get the following error
java.net.ConnectException: Tried all: 1 addresses, but could not connect over
HTTPS to server: demo.docusign.net port: 443;
Any pointers in this regard would be highly appreciated.
Thanks
Rashmi
Your error message is coming from the weblogic stack. Therefore, things to try:
Ensure that your server has Internet connectivity to https://demo.docusign.net by pinging from the console.
Check for https connectivity by using curl or similar.
Check that you're using the right method from your stack for https connections.
Since https://demo.docusign.net is definitely up and working (try it from a browser) the problem is local. Consult your stack vendor for additional help.

How Faye achieves cross-domain (XDR) pub/sub?

Faye supports cross-domain subscription. Here is an excerpt from their docs:
Cross-domain operation
Faye clients and servers transparently support
cross-domain communication, so your client can connect
to a server on any domain you like without further configuration.
Anyone knows how it achieves it?
Faye uses JSONP to send a handshake request to the server when it's cross-domain, as the author of Faye explains in his reply here. It then selects a new transport from a list, in order of preference: WebSocket, EventSource, XHR, CORS and JSON-P. Note that WebSockets, once established, can also work cross-domain as previously discussed here.

HTTPS Connection

I am making an application which has j2me in client side and dotnet on server side.
I need to make an https connection to post to and fetch data from the server.
Can anyone help?
I tried searching on the net but i cannot find much on internet about establishing https connection.
Can anyone explain or reccommend a website??
If you had problems finding J2ME HTTPS examples, this is a nice article.
The above link doesn't work any more. Alternative articles:
IBM Developerworks
Possible causes of https not working is because the server does not have a valid certificate. Try catching exceptions in the part where you make the connection.

Resources