A simple login cloudflare access and store token into .cloudflared
with using NodeJS
I'm not cloudflared developer. I use code reference from repo Cloudflared. The reason why I made this. Because I use from porject FishTerm.
npm install https://github.com/mrwan200/cloudflare-access-login
or
yarn add https://github.com/mrwan200/cloudflare-access-login
cflogin <URL_ACCESS>
import { CloudflreAccess } from "./access";
const cf = new CloudflreAccess();
cf.events.on("login", (url) => {
// Will return URL for authentication
}));
cf.events.on("complete", (token) => {
// Will retuen token for access tunnel, etc.
})
cf.login('<ACCESS_URL>').then(() => {})