Sending an auth token from a website to a raspberry pi on my local network

Hi, I’m looking for help with a GPS tracking project. I have a node.js file on my Raspberry Pi that has an auth token hard coded in and obtains GPS co-ordinate data from the Blynk smartphone app/server.
However I don’t want the auth token to be hard coded.
I’ve made a website/web app on Glitch using node.js in which a user can register devices and auth tokens. I want to send the auth token of the selected device to the node.js file on my pi.
I’m still quite new to programming. I have some familiarity with Java, Javascript HTML and CSS. I assume I’m going to need to turn my Raspberry Pi into a webserver? I’ve installed apache2 and have it up and running. After that I’m stumped. Can anyone advise me on how to get the node.js file to accept the HTTP request and store the auth token as a variable?

The node.js file on my raspberry pi looks like this:

var Blynk = require("blynk-library");

var AUTH = 'YOUR-AUTH-TOKEN';

var blynk = new Blynk.Blynk(AUTH);

var v1 = new blynk.VirtualPin(1);

var wia = require('wia')('YOUR-DEVICE-SECRET-KEY');

v1.on('write', function(param) {
console.log("v4: lat. " + param[0])
wia.locations.publish({
 latitude: param[0],
 longitude: param[1]
});
});

wia.stream.connect();

Why not? And why do you want whatever it is you are doing, done??

The AUTH is generated by the Blynk Server automatically upon Project creation and any extra devices added to it.

As far as I know, this action can, currently, only be done via the App, which is not open source, so I do not think you can do whatever it is you are trying to do… :crazy_face:

1 Like

Thanks for the reply Gunner! Good to know that at least so I don’t waste any more time going down this rabbit hole!

This project is an assignment for a part time online course for a module on IoT. The idea is to integrate various modules together, i.e. web development, IoT, databases etc. I wanted the user to be able to do everything via the web app and not have to touch the command line/shell.

I wasn’t sure if what I was doing was actually possible or not, I don’t have enough subject knowledge tbh! Doing my best to learn, but the assignment deadline is quickly approaching!