Skip to content

JWT user authentication strategy with access and refresh tokens in an Express app

License

Notifications You must be signed in to change notification settings

Ons-diweni/MoveMate-Node

Repository files navigation

$\ \ \textcolor{Tan}{REST \ API \ built\ with \ Express, \ which \ allows \ managing \ user \ authentication \ }$

$\ {The \ API \ offers \ two \ main \ endpoints: \ }$

$\textcolor{DeepPink}{/register }$ : 𝘵𝘰 𝘢𝘭𝘭𝘰𝘸 𝘢 𝘯𝘦𝘸 𝘶𝘴𝘦𝘳 𝘵𝘰 𝘳𝘦𝘨𝘪𝘴𝘵𝘦𝘳
$\textcolor{DeepPink}{/login }$ : 𝘵𝘰 𝘢𝘭𝘭𝘰𝘸 𝘢𝘯 𝘦𝘹𝘪𝘴𝘵𝘪𝘯𝘨 𝘶𝘴𝘦𝘳 𝘵𝘰 𝘭𝘰𝘨 𝘪𝘯

$\ {𝘍𝘰𝘶𝘳 \ middleware \ functions : \ }$

$\textcolor{Turquoise}{errorMiddleware }$ :𝘵𝘰 𝘩𝘢𝘯𝘥𝘭𝘦 𝘦𝘳𝘳𝘰𝘳𝘴 𝘢𝘯𝘥 𝘳𝘦𝘵𝘶𝘳𝘯 𝘢𝘱𝘱𝘳𝘰𝘱𝘳𝘪𝘢𝘵𝘦 𝘳𝘦𝘴𝘱𝘰𝘯𝘴𝘦𝘴 𝘵𝘰 𝘵𝘩𝘦 𝘤𝘭𝘪𝘦𝘯𝘵
$\textcolor{Turquoise}{loginRateLimiter }$ :𝘵𝘰 𝘭𝘪𝘮𝘪𝘵 𝘵𝘩𝘦 𝘯𝘶𝘮𝘣𝘦𝘳 𝘰𝘧 𝘭𝘰𝘨𝘪𝘯 𝘢𝘵𝘵𝘦𝘮𝘱𝘵𝘴 𝘧𝘳𝘰𝘮 𝘵𝘩𝘦 𝘴𝘢𝘮𝘦 𝘐𝘗 𝘢𝘥𝘥𝘳𝘦𝘴𝘴
𝘛𝘩𝘦 𝘭𝘰𝘨𝘪𝘯𝘙𝘢𝘵𝘦𝘓𝘪𝘮𝘪𝘵𝘦𝘳 𝘮𝘪𝘥𝘥𝘭𝘦𝘸𝘢𝘳𝘦 𝘶𝘴𝘦𝘴 𝘵𝘩𝘦 𝘙𝘦𝘥𝘪𝘴 𝘴𝘦𝘳𝘷𝘦𝘳 𝟽.𝟶.𝟷𝟶 𝘢𝘯𝘥 𝘵𝘩𝘦 𝘳𝘢𝘵𝘦-𝘭𝘪𝘮𝘪𝘵𝘦𝘳-𝘧𝘭𝘦𝘹𝘪𝘣𝘭𝘦 𝘭𝘪𝘣𝘳𝘢𝘳𝘺 𝘵𝘰 𝘴𝘵𝘰𝘳𝘦 𝘢𝘯𝘥
𝘮𝘢𝘯𝘢𝘨𝘦 𝘵𝘩𝘦 𝘤𝘰𝘯𝘯𝘦𝘤𝘵𝘪𝘰𝘯 𝘥𝘢𝘵𝘢.
𝘛𝘩𝘪𝘴 𝘢𝘭𝘭𝘰𝘸𝘴 𝘧𝘰𝘳 𝘮𝘰𝘳𝘦 𝘦𝘧𝘧𝘪𝘤𝘪𝘦𝘯𝘵 𝘢𝘯𝘥 𝘳𝘦𝘭𝘪𝘢𝘣𝘭𝘦 𝘳𝘢𝘵𝘦 𝘭𝘪𝘮𝘪𝘵𝘪𝘯𝘨, 𝘢𝘴 𝘙𝘦𝘥𝘪𝘴 𝘪𝘴 𝘢 𝘧𝘢𝘴𝘵 𝘢𝘯𝘥 𝘳𝘦𝘭𝘪𝘢𝘣𝘭𝘦 𝘪𝘯-𝘮𝘦𝘮𝘰𝘳𝘺 𝘥𝘢𝘵𝘢 𝘴𝘵𝘰𝘳𝘦.
$\textcolor{Turquoise}{signUpSchemaValidator}$ : 𝘵𝘰 𝘷𝘢𝘭𝘪𝘥𝘢𝘵𝘦 𝘵𝘩𝘦 𝘶𝘴𝘦𝘳 𝘳𝘦𝘨𝘪𝘴𝘵𝘳𝘢𝘵𝘪𝘰𝘯 𝘥𝘢𝘵𝘢 𝘶𝘴𝘪𝘯𝘨 𝘵𝘩𝘦 𝘑𝘰𝘪 𝘭𝘪𝘣𝘳𝘢𝘳𝘺.
$\textcolor{Turquoise}{authMiddleware}$ : 𝘵𝘰 𝘷𝘦𝘳𝘪𝘧𝘺 𝘵𝘩𝘦 𝘦𝘹𝘪𝘴𝘵𝘦𝘯𝘤𝘦 𝘢𝘯𝘥 𝘵𝘩𝘦 𝘢𝘶𝘵𝘩𝘦𝘯𝘵𝘪𝘤𝘪𝘵𝘺 𝘰𝘧 𝘵𝘩𝘦 𝘵𝘰𝘬𝘦𝘯 𝘵𝘳𝘢𝘯𝘴𝘮𝘪𝘵𝘵𝘦𝘥 𝘪𝘯 𝘵𝘩𝘦 𝘳𝘦𝘲𝘶𝘦𝘴𝘵 𝘩𝘦𝘢𝘥𝘦𝘳𝘴 𝘢𝘯𝘥 𝘢𝘵𝘵𝘢𝘤𝘩 𝘵𝘩𝘦 𝘥𝘦𝘤𝘳𝘺𝘱𝘵𝘦𝘥 𝘶𝘴𝘦𝘳 𝘪𝘯𝘧𝘰𝘳𝘮𝘢𝘵𝘪𝘰𝘯 𝘵𝘰 𝘵𝘩𝘦 𝘳𝘦𝘲𝘶𝘦𝘴𝘵 𝘰𝘣𝘫𝘦𝘤𝘵 (𝘳𝘦𝘲.𝘶𝘴𝘦𝘳) 𝘧𝘰𝘳 𝘵𝘩𝘦 𝘴𝘶𝘣𝘴𝘦𝘲𝘶𝘦𝘯𝘵 𝘮𝘪𝘥𝘥𝘭𝘦𝘸𝘢𝘳𝘦 𝘪𝘯 𝘵𝘩𝘦 𝘤𝘩𝘢𝘪𝘯.

$\ {To \ test : \ }$

$\textcolor{Turquoise}{git \ clone \ URL }$ : 𝘊𝘭𝘰𝘯𝘦 𝘵𝘩𝘪𝘴 𝘳𝘦𝘱𝘰𝘴𝘪𝘵𝘰𝘳𝘺 𝘵𝘰 𝘺𝘰𝘶𝘳 𝘭𝘰𝘤𝘢𝘭 𝘮𝘢𝘤𝘩𝘪𝘯𝘦
$\textcolor{Turquoise}{npm \ install }$ : 𝘐𝘯𝘴𝘵𝘢𝘭𝘭 𝘵𝘩𝘦 𝘥𝘦𝘱𝘦𝘯𝘥𝘦𝘯𝘤𝘪𝘦𝘴
$\textcolor{Turquoise}{npm \ run \ dev }$ : 𝘙𝘶𝘯 𝘵𝘩𝘦 𝘢𝘱𝘱𝘭𝘪𝘤𝘢𝘵𝘪𝘰𝘯

Releases

No releases published

Packages

No packages published