How does grafana appends the new token received from the OAuth2 url configured in proxy routes

If you configure tokenAuth for your route, Grafana will manage the tokens in the background for you. If you need custom authentication, you need to implement it yourself in a backend plugin.

For more information, check out the docs on how to Authenticate using a backend plugin.