Pass Neo4j Auth from Server to Client

Howdy,

Using node.js and .ejs

What is the best way to pass neo4j.driver auth info from server to client? I'm assuming this can be done?

Here's what I have...


server.js

const driver = neo4j.driver('bolt://localhost:7687', neo4j.auth.basic('abc','123'));
const session = driver.session();

Then on the client side I have the following. At this point I am 'hard-coding' the username and password into the AUTHORIZATION, but I'm hoping there's a way to pull this info from the server using the const driver or const session?


index.ejs

var AUTHORIZATION = "Basic " + btoa("abc:123"); //are there variables from the server I can put here?
...
//Then there is another section requesting AUTHORIZATION
function displayGraph() {

    // Create the authorization header for the ajax request.
    AUTHORIZATION = "Basic " + btoa("abc"+":"+"123"); //again hoping to use variables from server side
...


It's likely worth noting that this involves an AJAX call that uses the AUTHORIZATION var that is used to render a vis.js graph using Neo4j data, and all of this vis.js auth code is currently setup on the client side.

Hello,

Is the following description correct? You have a server responsible for querying a Neo4j database and a front-end sending requests to that server in order to retrieve data to display.

Why would the front-end send the Neo4j credentials? Isn't connecting to Neo4j a purely server-side concern?

That's a great question, I don't have an answer as to why the 2 examples I'll share below were created with client-side Neo4j auth, so I'm hoping someone can point me in a better direction for displaying a Neo4j graph with vis.js.

The greater context is this... I'm trying to display a graph visualization on my app and I've been trying neovis and straight up vis.js.

/1. The @johnymontana neovis solution has set up client-side Neo4j auth. I'm not sure why.

/2. Another solution strictly using vis.js also has set up client-side Neo4j auth.
http://ciminf.github.io/Hacking-Health-Camp-Hackathon/display-graph.html

If anyone can point me to an example of displaying a graph in this fashion using neovis/vis.js from server--to-->client, I would be grateful.

FWIW, I'm not very fond of neovis since it seems to be tied to leveraging pagerank, community, weight, and other 'data science stuff' that is unnecessary for my work, as opposed to just displaying one's Neo4j graph. I just want to display my Neo4j data set as a graph ideally using vis.js.