Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| // Adapted from https://stackoverflow.com/questions/34848505/how-to-make-a-loading-animation-in-console-application-written-in-javascript-or | |
| /** | |
| * Create and display a loader in the console. | |
| * | |
| * @param {string} [text=""] Text to display after loader | |
| * @param {array.<string>} [chars=["⠙", "⠘", "⠰", "⠴", "⠤", "⠦", "⠆", "⠃", "⠋", "⠉"]] | |
| * Array of characters representing loader steps | |
| * @param {number} [delay=100] Delay in ms between loader steps | |
| * @example |
| # pull the Node.js Docker image | |
| FROM node:alpine | |
| # create the directory inside the container | |
| WORKDIR /var/www/api | |
| # copy the package.json files from local machine to the workdir in container | |
| COPY package*.json ./ | |
| # run npm install in our local machine |
| import * as React from "react" | |
| import { useState, useEffect } from "react" | |
| // Hook | |
| let cachedScripts = [] | |
| export function useScript(src) { | |
| // Keeping track of script loaded and error state | |
| const [state, setState] = useState({ | |
| loaded: false, |
| var fs = require("fs") | |
| var ssl_options = { | |
| key: fs.readFileSync('privatekey.pem'), | |
| cert: fs.readFileSync('certificate.pem') | |
| }; | |
| var port = process.env.PORT || 3000; | |
| var express = require('express'); | |
| var ejs = require('ejs'); | |
| var passport = require('passport') |