You might be wondering what is this auth0
it is used for authentication of you applications
could be any apps
1.SPA - Angular , React
2.web app
3.Node
here we will talk about the node use case and go with example
moving ahead for now
if your are not familiar with node dont worry its a funny exercise
for now walk with me
we dont have to worry too much for authentication as the service is
provided from auth0
create your node app
install node
https://nodejs.org/en/download/package-manager/
choose your os and do the installation
once installed check for the version ' node -v '
i assume u have installed so that u wil get the version for now
since iam using LINUX this will look like
root@strings-desktop:/home/strings/js# node -v
v16.13.0
moving on to creating node app for now
create a file app.js and paste the contents
app.js/
const http = require('http');
const express = require('express');
const app = express();
const hostname = '127.0.0.1';
const port = 3000;
http.createServer(app)
.listen(port, () => {
console.log(`Listening on `);
});
app.get('/', (req, res) => {
console.log('entering node app')
res.send('Node app created');
});
in the folder start ur app with node app your node app will be hosted
alright now we will move on to the interesting section of adding auth0 to node.
once u have signed up u wil get a client and domain which we will use to
configure in our app
next click on the getting started link on the left side of the screen
click on the create Application
click on the node js which is highlighted and create
ok now have created the required things in auth0 side and u can the url
which is our hosted url - http://localhost:3000
for the integration check out
https://talkersscienz.blogspot.com/2022/07/node-and-auth0-integration.html
reference - https://auth0.com/
Comments
Post a Comment