Hey,
I’ve got an Auth0 app though Auth0.swift for my iOS app, and I got it to work properly but I need to have a delete user button. One problem with this is that based on what I’ve read theres no way to delete users though the sdk and I found a related question here I need to delete user account in my iOS project(swift) is that applicable from mobile side? but I need help in creating an API. Can someone pls help me understand how to create an backend api using node?
Here’s my current code I got from a quickstart:
const express = require('express');
const app = express();
const { auth, requiredScopes } = require('express-oauth2-jwt-bearer');
// Authorization middleware. When used, the Access Token must
// exist and be verified against the Auth0 JSON Web Key Set.
const checkJwt = auth({
audience: 'http://GitaApi:5000',
issuerBaseURL: `https://dev-1lh8f0uy7cxikoik.us.auth0.com/`,
});
// This route doesn't need authentication
app.get('/api/public', function(req, res) {
res.json({
message: 'Hello from a public endpoint! You don\'t need to be authenticated to see this.'
});
});
// This route needs authentication
app.get('/api/private', checkJwt, function(req, res) {
res.json({
message: 'Hello from a private endpoint! You need to be authenticated to see this.'
});
});
const checkScopes = requiredScopes('read:messages');
app.get('/api/private-scoped', checkJwt, checkScopes, function(req, res) {
res.json({
message: 'Hello from a private endpoint! You need to be authenticated and have a scope of read:messages to see this.'
});
});
app.listen(3000, function() {
console.log('Listening on http://localhost:3000');
});
Thanks,
Arjun