Company
Date Published
Author
Evgeny Komarevtsev
Word count
695
Language
English
Hacker News points
None

Summary

Machine-to-machine (M2M) tokens function as security keys in OAuth 2.0 authorization flows, facilitating secure data exchange between machines or applications without human intervention. These tokens are particularly useful for authorizing external providers to access APIs or enabling secure communication between services or microservices. The process involves registering a free Kinde account, configuring an M2M application, and connecting it to an API using Kinde's settings. A Golang command-line application can be set up using open-source libraries like jwt-go, keyfunc, and GoDotEnv, which assist in managing environment variables and handling token requests. The application utilizes the client_credentials flow to authorize APIs by obtaining a token from Kinde and attaching it to API requests. To secure the receiving API, the application verifies the token's validity, issuer, and audience using the keyfunc library.