Access to Grafana with nodejs login page

how i can connect to grafana with other application ?
i try with auth.generic_auth but didn’t work
this my config:

enabled = true
name = OAuth
allow_sign_up = true
auth_url = http://localhost:8000/login

this my nodejs login:’/login’, function(req,res,next){
let promise = User.findOne({}).exec();
if(doc) {
// generate token
let token = jwt.sign(doc.toObject(),‘secret’, {expiresIn : ‘3h’});
return res.cookie(‘cookies_session’,token).status(200).redirect(‘http://localhost:3000/’);
} else {
return res.status(501).json({message:’ Invalid Credentials’});
else {
return res.status(501).json({message:‘User email is not registered.’})
return res.status(501).json({message:‘Some internal error’});

my server work, but the question is how grafana can know the user or token