Skip to content

Instantly share code, notes, and snippets.

View jasminsehic's full-sized avatar

Jasmin Sehic jasminsehic

  • Perth
View GitHub Profile
const scrapeOAuthForm = async () => {
const crypto = require('crypto');
const URLSafeBase64 = require('urlsafe-base64');
const cryptoRandomString = require('crypto-random-string');
const codeVerifier = URLSafeBase64.encode(cryptoRandomString({length: 86, type: 'alphanumeric'})).trim();
const hash = crypto.createHash('sha256').update(codeVerifier).digest('hex');
const buf = Buffer.from(hash, 'utf8');
const codeChallenge = URLSafeBase64.encode(buf).trim();
const state = 'TeslaTime'