Skip to content

Instantly share code, notes, and snippets.

View t1mofe1's full-sized avatar

Timothy Myagi t1mofe1

View GitHub Profile
@zmts
zmts / tokens.md
Last active July 20, 2024 02:49
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@t1mofe1
t1mofe1 / time-helper.ts
Last active October 25, 2022 21:44
IMPORTANT!! `formatStrToTime` will show different result if you did `formatTimeToStr` with different depth
export const timeUnits = [
// { name: "y", milliseconds: 31_536_000_000 },
// { name: "mo", milliseconds: 2_592_000_000 },
{ name: "d", milliseconds: 86_400_000 },
{ name: "h", milliseconds: 3_600_000 },
{ name: "m", milliseconds: 60_000 },
{ name: "s", milliseconds: 1_000 },
{ name: "ms", milliseconds: 1 },
];