So, I spent some more time deciphering the instructions at https://developer.spotify.com/documentation/general/guides/authorization-guide/ and I actually found a rather simple solution for this.
What I want to do is retrieve Spotify album URIs from the Spotify Web API by searching for specifc albums. Since I don't need refreshable access tokens for that and I don't need to access user data, I decided to go with the Client Credentials Authorization Flow (https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow). Here's what I did:
Create an application on the Dashboard at https://developer.spotify.com/dashboard/applications and copy client ID and client secret
Encode client ID and Client secret with base64:
echo -n <client_id:client_secret> | openssl base64
Request authorization with the encoded credentials, which provided me with an access token:
curl -X "POST" -H "Authorization: Basic <my_encoded_credentials>" -d grant_type=client_credentials https://accounts.spotify.com/api/token
With that access token it's possible to make requests to the API endpoints, that don't need user authorization, for example:
curl -H "Authorization: Bearer <my_access_token>" "https://api.spotify.com/v1/search?q=<some_artist>&type=artist"
All available endpoints can be found here: https://developer.spotify.com/documentation/web-api/reference/
In my case I want to read input in the Terminal in the format "artist album" and output the corresponding spotify URI, which is exactly what the following shell script does:
#!/bin/bash
artist=$1
album=$2
creds="<my_encoded_credentials>"
access_token=$(curl -s -X "POST" -H "Authorization: Basic $creds" -d grant_type=client_credentials https://accounts.spotify.com/api/token | awk -F"\"" '{print $4}')
result=$(curl -s -H "Authorization: Bearer $access_token" "https://api.spotify.com/v1/search?q=artist:$artist+album:$album&type=album&limit=1" | grep "spotify:album" | awk -F"\"" '{print $4 }')
I can then run the script like this:
myscript.sh some_artist some_album
and it will output the album URI.