frontpage-content/projects/simple-cb.adoc

27 lines
1.1 KiB
Plaintext

:experimental:
:docdatetime: 2022-10-18T17:56:27+02:00
= Simple Callback Server
This is probably my simplest project.
== What is this?
It's the simplest thing you could imagine: An `express` server that prints out all headers and the body or all query parameters.
Still, I needed it sometimes and I didn't want to rewrite it every time I use it.
== What can it be used for?
When creating a dev application on Google, Spotify, or other services you often have some heavy authentication flow to get access.
But normally I want to use the API for private projects and it's _my_ account that gets authenticated every time.
To make reauthentication easier these OAuth protocols often provide a "refresh token" which can be used to get a valid new token.
To get the initial authentication token and to get such a refresh token you provide a callback address where you get redirected after the user logs in.
The tokens and meta information normally are sent in a `POST` body.
And this is where this small application is necessary.
=== This sounds overly complicated
It is. But this is necessary for OAuth2 to be safe.