kemal-threebot-oauth
threebot
Threebot login module for kemalcr.com applications and for crystal lang in general
Installation
-
Add the dependency to your
shard.yml
:dependencies: threebot: github: crystaluniverse/kemal-threebot
-
Run
shards install
How to use
Download, compile & run 0-db (Backend for BCDB)
git clone git@github.com:threefoldtech/0-db.git
cd 0-db && make
./zdb --mode seq
Download, compile & run BCDB (Backend for BCDB)
- Install Rust programming language
git clone git@github.com:threefoldtech/bcdb.git
cd bcdb && make
- copy bcdb binary anywhere
cp bcdb/target/x86_64-unknown-linux-musl/release/bcdb .
- download
tfuser
utility from here - use
tfuser
to register your 3bot user to explorer and generate seed fileusr.seed
using./tfuser id create --name {3bot_username.3bot} --email {email}
- run bcdb :
./bcdb --seed-file user.seed
- now you can talk to
bcdb
through http via unix socket/tmp/bcdb.sock
Export needed environment vars
export SEED="sY4dAEWZXsPQEMOHzP65hNeDr4+7D0D6fbEm2In22t0="
export OPEN_KYC_URL=https://openkyc.live/verification/verify-sei
export THREEBOT_LOGIN_URL=https://login.threefold.me
Usage (Kemal.rc example)
require "kemal-session"
require "kemal-session-bcdb"
require "kemal"
require "threebot"
include Threebot
def login(context, email, identifier)
pp! email
pp! identifier
end
notes
- You must include
Threebot
module - You must provide
def login(context, email, identifier)
method with your login logic, including any redirection after successful login
Require and add session settings if not included
require "kemal"
require "kemal-session"
require "kemal-session-bcdb"
Kemal::Session.config do |config|
config.cookie_name = "redis_test"
config.secret = "a_secret"
config.engine = Kemal::Session::BcdbEngine.new(unixsocket= "/tmp/bcdb.sock", namespace = "kemal_sessions", key_prefix = "kemal:session:")
config.timeout = Time::Span.new hours: 200, minutes: 0, seconds: 0
end
URL to use for 3botligin
- URL to redirect to 3bot login
{domain}/threebot/login
Repository
kemal-threebot-oauth
Owner
Statistic
- 0
- 2
- 0
- 0
- 2
- over 4 years ago
- July 19, 2020
License
MIT License
Links
Synced at
Fri, 08 Nov 2024 08:21:28 GMT
Languages