When I login to a webpage using Basic Auth, is there a way to get the username and password I used to log in with during the session?

I am connecting to a websocket from that page and want to re-use username and password to make sure the ws connection is coming from this user.