OAuth autologin and anonymous access at the same time

I have an architecture where my application is embedding Grafana panels and Grafana fetches data from the application, forwarding the OAuth credentials. Since the user is already signed to the application using the same SSO server it’s convenient to enable autologin so that the Grafana queries have the correct credentials and the panel loads without requiring explicit login.

However, some of the data are publicly available and it would be nice if I could just share link to Grafana dashboard with anonymous access (which is currently disabled to make auto-login work).

Is there any neat trick that would trigger auto-login based on URL? In that case I could embed the panels and keep the workflow for authenticated user, and still allowing anonymous access.

Thanks!