Developing a new datasource. Our new datasource is integrated with a third party oauth provider so we have to make 2 calls initially one to the oauth provider and then one to the “datasource” endpoint. Both of these are “backend” proxy calls. If we try to just submit through the backendSrv it turns it into a direct call vs proxy which then gives us CORS errors. How could we make 2 backendSrv calls to 2 different URL’s?
You can specify multiple routes in your plugin.json file:
Then when you build your url in your datasource class, the url should start with the text specified in the path field for a route. The proxy will strip out the path text and replace it with the value in the url field.
For example, if my code makes a call to url azuremonitor/foo/bar with this code: