It I define a route in my datasource plugin, then set up an instance of that plugin with the required configuration information, it will connect fine and the OAuth token gets cached as expected.
Subsequent calls for that route then use the token.
If I then change the configuration information for that instance of the datasource information (to use another tenant for example) then the Token that was cached is re-used! A new token is not obtained because Grafana doesn’t see the change. Also, if I create a second instance pointing at another tenant then the token from the first instance is used and I’ll get 403 errors.
Anybody else experiencing anything similar with datasource plugins?
There is currently no way to clear the token cache - you will just have to wait until the token expires.