Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

How not to fuck up OAuth2

I've seen a number of articles posted here recently that just give terrible advice when it comes to OAuth2, so I figured I'd make this so people would dick themselves over.

The reason people do this, is because they are just writing filler nonsense content in the hopes you'll click on the website. They don't care if the content is solid because they just want you to see the ads.

As for my credentials, I work for a major fintech company with part of my duties being to help developers get set up with OAuth2 in their applications.

If you aren't a lazy fuck, just read this, and the next section on decoupling. Otherwise I've summarised the important bits later on.

@whynotavailable
whynotavailable / index.js
Last active November 1, 2021 03:57
example.js
class Example {
flip(text) {
return [...text].reduce((previousValue, currentValue) => currentValue + previousValue, '');
}
run(text) {
return this.flip(padLeft(text))
function padLeft() {
return '000' + text;
npx swagger-typescript-api --no-client -p http://localhost:5183/swagger/v1/swagger.json -n model.ts
const axios = require('axios');
async function run() {
try {
const handler = require('./calls/' + process.argv[process.argv.length - 1]).handler
await handler();
} catch (error) {
console.error(error);
}
}
@whynotavailable
whynotavailable / emacs.el
Last active February 16, 2024 03:46
emacs
(require 'package)
(cond
((string-equal system-type "windows-nt")
(progn
(setq
ispell-program-name "C:\\ProgramData\\chocolatey\\bin\\hunspell.exe"
ispell-current-dictionary "en_US"
ispell-dictionary "en_US"
ispell-hunspell-dict-paths-alist
#write {
max-width: 914px;
}
body {
font-family: "Open Sans" !important;
}
.cm-s-inner {
font-family: "JetBrains Mono" !important;
@mixin snackbar-colors($color, $on-color: 'on-' + $color) {
--mdc-snackbar-container-color: #{mat.get-theme-color($my-theme, $color)};
--mdc-snackbar-supporting-text-color: #{mat.get-theme-color($my-theme, $on-color)};
--mat-snack-bar-button-color: #{mat.get-theme-color($my-theme, $on-color)};
}
{
"security.workspace.trust.untrustedFiles": "open",
"explorer.confirmDelete": false,
"workbench.colorTheme": "Night Owl",
"editor.fontSize": 13,
"editor.formatOnSave": true,
"files.autoSave": "onFocusChange",
"editor.rulers": [
100,
120
@whynotavailable
whynotavailable / slices.go
Created August 27, 2024 10:35
Functions for slice transformations in go
func Reduce[TAcc any, T any](list []T, reducer func(TAcc, T) TAcc, init TAcc) TAcc {
acc := init
for _, t := range list {
acc = reducer(acc, t)
}
return acc
}