title: Replacing OAuth2 Implicit Grant with Authorization Code without Client Secret
body: <p>OAuth 2.0 Auth Code without Client Secret is being used in lieu of Implicit Grant for client-side JavaScript apps by a few companies. What are the general advantages / tradeoffs of using Auth Code without Client Secret vs. Implicit Grant? Are there more companies and/or standards organizations moving this way?</p>
  
  <p>Red Hat, Deutsche Telekom and others have moved this way per this article and the IETF OAuth mailing list posts below.</p>
  
  <ul>
  <li><a href="https://aaronparecki.com/oauth-2-simplified/" rel="noreferrer">https://aaronparecki.com/oauth-2-simplified/</a></li>
  </ul>
  
  <blockquote>
    <p><strong>Implicit</strong> was previously recommended for clients without a secret, but has been superseded by using the Authorization Code grant with no secret.</p>
    
    <p>...</p>
    
    <p>Previously, it was recommended that browser-based apps use the "Implicit" flow, which returns an access token immediately and does not have a token exchange step. In the time since the spec was originally written, the industry best practice has changed to recommend that the authorization code flow be used without the client secret. This provides more opportunities to create a secure flow, such as using the state parameter. References: <a href="https://www.ietf.org/mail-archive/web/oauth/current/msg16966.html" rel="noreferrer">Redhat</a>, <a href="https://www.ietf.org/mail-archive/web/oauth/current/msg16968.html" rel="noreferrer">Deutsche Telekom</a>, <a href="https://www.ietf.org/mail-archive/web/oauth/current/msg16967.html" rel="noreferrer">Smart Health IT</a>.</p>
  </blockquote>
  
  <p>Here are the messages referenced above.</p>
  
  <p><a href="https://www.ietf.org/mail-archive/web/oauth/current/msg16966.html" rel="noreferrer">Red Hat</a></p>
  
  <blockquote>
    <p>For our IDP [1], our <em>javascript</em> library uses the auth code flow, but requires a public client, redirect_uri validation, and also does CORS checks and processing.  We did not like Implicit Flow because</p>
    
    <p>1) access tokens would be in the browser history</p>
    
    <p>2) short lived access tokens (seconds or minutes) would require a browser redirect</p>
  </blockquote>
  
  <p><a href="https://www.ietf.org/mail-archive/web/oauth/current/msg16968.html" rel="noreferrer">Deutsche Telekom</a></p>
  
  <blockquote>
    <p>Same for Deutsche Telekom. Our <em>javascript</em> clients also use code flow with CORS processing and of course redirect_uri validation.</p>
  </blockquote>
  
  <p><a href="https://www.ietf.org/mail-archive/web/oauth/current/msg16967.html" rel="noreferrer">SMART Health IT</a></p>
  
  <blockquote>
    <p>We've taken a similar approach for SMART Health IT [1], using the code flow for public clients to support in-browser apps, and &lt;1h token lifetime. (We also allow these public clients to request a limited-duration refresh token by asking for an "online_access" scope; these refresh tokens stop working when the user's session with the AS ends — useful in systems where that session concept is meaningful.)</p>
  </blockquote>