What you have linked to doesn’t cover token generation, and describes using tokens in the front end, (which generally speaking you shouldn’t use unless it’s the website users own token)
This is the documentation for server side token generation
Provides three different language examples on generating a server side token.
A Client Secret IS NOT A BEARER TOKEN