Skip to content

Instantly share code, notes, and snippets.

@4refr0nt
4refr0nt / tokens.md
Created January 29, 2021 08:20 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
////////////////////////////////////////////////
//
// Demo device emulator for "simple-btn" widget
//
//
//
// IoT Manager https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
//
// version : 1.0
// IoT Manager : 1.4.7 and above
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- subscribes to the topic "/IoTmanager" (waiting "HELLO" messages from mobile device)
- publishes config to the topic "/IoTmanager/config/deviceID/"
Tested with Arduino IDE 1.6.7 + ESP8266 Community Edition v 2.1.0-rc2
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.7 + ESP8266 Community Edition v 2.1.0-rc1 and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ArduinoJson library 5.0.7 https://github.com/bblanchon/ArduinoJson
////////////////////////////////////////////////
//
// Demo device emulator for "display-value" widget
//
// 4 different colors demo display-value widgets with random data (colors: red, green, blue, yellow)
//
// IoT Manager https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
//
// version : 1.4
// IoT Manager : 1.4.6 and above
@4refr0nt
4refr0nt / IoTmanager3.ino
Created December 26, 2015 05:16
fillgauge widget demo for IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.
////////////////////////////////////////////////
//
// Demo device emulator for "fillgauge" widget
//
// 2 tanks and 2 pumps and 4 level sensors.
// If tank have liquid, then you can activate pump for pumping out. After pumping out, pump deactivated automaticaly.
//
// IoT Manager https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
//
// version : 1.0
@4refr0nt
4refr0nt / demo.js
Last active October 28, 2017 20:50
////////////////////////////////////////////////
//
// Demo device emulator for "toggle" widget
//
//
// IoT Manager https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
//
// version : 1.0
// IoT Manager : 1.4.1 and above
//
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.
@4refr0nt
4refr0nt / IoTmanager.ino
Last active July 21, 2020 13:01
ESP8266 client for IoT Manager (Android app)
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.