title: How to configure Shiny in Azure app service with Azure AD authentication
body: <p>I found <a href="https://cran.r-project.org/web/packages/AzureAuth/vignettes/shiny.html" rel="nofollow noreferrer">vignette on using the AzureAuth</a> package with Shiny which seems to be a modified version of <a href="https://gist.github.com/hadley/144c406871768d0cbe66b0b810160528" rel="nofollow noreferrer">this httr Sketch of shiny + oauth</a>.</p>
  <p>It's unclear, to me at least, how to connect the names in that guide to what I can find in my Azure Portal.</p>
  <p>That guide asks for tenant, app, resource, and redirect.</p>
  <p>I presume that for tenant and app I should use the IDs from here:</p>
  <p><a href="https://i.stack.imgur.com/Iye4D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Iye4D.png" alt="Azure portal screen shot" /></a></p>
  <p>For resource, do I leave in the <code>c(&quot;https://management.azure.com/.default&quot;, &quot;openid&quot;)</code> or do I change it to the endpoints found in the portal, ie. <a href="https://login.microsoftonline.com/" rel="nofollow noreferrer">https://login.microsoftonline.com/</a>&lt;tenant_id&gt;/oauth2/v2.0/authorize?</p>
  <p>I changed it to just <code>&quot;openid&quot;</code>.</p>
  <p>Should the <code>redirect</code> variable be the URL of my app, the callback URL or something else?</p>
  <p>ie. <a href="https://myapp.azurewebsites.net" rel="nofollow noreferrer">https://myapp.azurewebsites.net</a> or <a href="https://myapp.azurewebsites.net/.auth/login/aad/callback" rel="nofollow noreferrer">https://myapp.azurewebsites.net/.auth/login/aad/callback</a></p>
  <p>I'm going with the former.  This is all in a docker container using rocker as the base.</p>
  <p>With all this I'm getting 500 errors after I authenticate.  Of course, Azure has middleware inbetween my container and the exposed internet that is redirecting to their login regardless of anything in my code.  The problem is in the handoff from being authenticated to the callback.  That's where things seem to break.</p>
  <p>Edit: Turns out I was barking up the wrong tree entirely.  The problem I was having was this...</p>
  <p><a href="https://stackoverflow.com/questions/56300156/query-headers-too-large-on-azure-if-auth-enabled">Query/headers too large on Azure if auth enabled</a></p>
  <p><a href="https://stackoverflow.com/questions/65146257/r-shiny-app-on-azure-app-services-with-active-directory-integration">R Shiny app on Azure App Services with Active Directory Integration</a></p>