frontpage-content/projects/simple-cb.adoc

27 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2022-08-08 12:19:20 +02:00
:experimental:
2022-10-18 17:56:26 +02:00
:docdatetime: 2022-10-18T17:56:27+02:00
2022-08-08 12:19:20 +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?
2022-10-18 17:56:26 +02:00
When creating a dev application on Google, Spotify, or other services you often have some heavy authentication flow to get access.
2022-08-08 12:19:20 +02:00
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.
2022-10-18 17:56:26 +02:00
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.
2022-08-08 12:19:20 +02:00
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.