Comment on page
validateTokens
export default (app: express.Application) => {
const cors = require('cors')({ origin: true });
const middleware = new SlashauthMiddlewareExpress(slashauthClient);
app.use(cors);
app.use(express.json());
// Middleware to parse the slashauth token
app.use(middleware.parseAuthToken());
app.get('/', wrapAsync(healthCheck));
}
export const healthCheck: Handler = async (request, response) => {
// Make sure the user is authed
if (!request.slashauth.isAuthed) {
return response.sendStatus(401);
}
const clientID = request.slashauth.clientID;
const userID = request.slashauth.userID;
console.log('ClientID: ', clientID)
console.log('UserID: ', userID)
response.status(200).json({});
}
{
slashauth: {
wallet?: string;
userID?: string;
isAuthed?: boolean;
clientID?: string;
getWalletAddress(): Promise<string | null>;
};
}
Last modified 10mo ago