I have a custom database connection and in my login action script I am calling an API/WS endpoint that requires access token, How do I generate access token in the action script and pass it to the endpoint?
Below is the Auth0 documentation suggesting the same using client credentials flow in rules, my understanding of rules is that they execute after the authentication/login is done and used to modify the access token that’s already generated.
"Determine if they are accessing their database directly versus through an API.** This item is not a requirement; it is a recommended best practice. A database interface is extremely open. You should add protections between an API endpoint and your database. Most people do not expose their database directly to the internet. Though you can whitelist Auth0 IPs, those IPs are shared in the cloud environment. In general, Auth0 recommends that you protect your database from too many actors directly talking to it. The alternative is to create a simple API endpoint that each script within Auth0 can call. That API can be protected using an access token. You can use the client credentials flow to get the Access Token from within the rules.