title: disable confirmation page in Spring OAuth2
body: <p>I am studying Spring OAuth2 by decomposing the set of <a href="https://github.com/spring-guides/tut-spring-security-and-angular-js/tree/master/oauth2" rel="nofollow noreferrer">three interconnected sample apps at this GitHub link</a>.  The apps work as intended on my devbox, but the <code>authserver</code> app produces an unwanted confirmation page that asks the user to confirm that they authorize the client at <code>localhost:8080/login</code> to receive their protected information. A screen shot of the confirmation page is as follows:</p>
  <p><a href="https://i.stack.imgur.com/OYue2.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OYue2.gif" alt="" /></a></p>
    
  <p><strong>What specific changes need to be made to the <code>authserver</code> app's code to remove the confirmation step?</strong></p>
  <p>I understand that the confirmation page could be useful in certain use cases.  But the confirmation page is not appropriate for the use case that I have in mind, so how can I disable this step?</p>
  <hr />
  <p><strong>FIRST ATTEMPT:</strong></p>
  <hr />
  <p>I have located the view code for the authorization page in <a href="https://github.com/spring-guides/tut-spring-security-and-angular-js/blob/master/oauth2/authserver/src/main/resources/templates/authorize.ftl" rel="nofollow noreferrer"><code>authorize.ftl</code>, which you can read by clicking on this link</a>.  But when I do <code>Ctrl-H</code> in an eclipse workspace and search for &quot;authorize.ftl&quot;, no results show up.  Similarly, I reviewed the <a href="https://projects.spring.io/spring-security-oauth/docs/oauth2.html#customizing-the-ui" rel="nofollow noreferrer">Spring OAuth2 Developer Guide</a>.  Some mention in the guide is made of creating a separate <code>@RequestMappig(&quot;/oauth/authorize&quot;)</code>, but it did not seem clear how to disable this confirmation step.</p>
  <p>The code for the template <code>login</code> view is in <a href="https://github.com/spring-guides/tut-spring-security-and-angular-js/blob/master/oauth2/authserver/src/main/resources/templates/login.ftl" rel="nofollow noreferrer"><code>login.ftl</code>, which you can read at this link</a>.</p>
  <p><strong>Is the solution to simply move the <code>login.ftl</code> code into a new <code>login.html</code> file, and then manage that view with <code>@RequestMappig(&quot;/oauth/authorize&quot;)</code>?</strong></p>
  <p>If I interpret the working from the Developer Guide link above correctly, it seems to say that</p>
  <p>1.) an <code>@RequestMappig(&quot;/oauth/authorize&quot;)</code> method linked to GET would serve up the login view, then another <code>@RequestMappig(&quot;/oauth/authorize&quot;)</code>,</p>
  <p>2.) then another <code>@RequestMappig(&quot;/oauth/authorize&quot;)</code> method linked to POST would take the information from the view and bypass the confirmation step.</p>
  <p><strong>But what would this look like in code?</strong>  Here is a starting point, if I understand correctly:</p>
  <pre><code>`@RequestMappig(&quot;/oauth/authorize&quot;, method = RequestMethod.GET)`
  public @ResponseBody SomeType method1Name(){
      SomeType st = new SomeType();
      //do some stuff to st
      return st;
  }
  
  `@RequestMappig(&quot;/oauth/authorize&quot;, method = RequestMethod.POST)`
  public @ResponseBody SomeType method2Name(){
      SomeType st = new SomeType();
      //do other stuff to st
      return st;
  }
  </code></pre>
  <p>What do I put in the methods?  And then were do I put the view code?</p>
  <p>The Developer Guide says to start with <a href="https://github.com/spring-projects/spring-security-oauth/blob/master/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/WhitelabelApprovalEndpoint.java" rel="nofollow noreferrer"><code>WhiteLabelApprovalEndpoint,java</code>, which you can read on GitHub at this link</a>.</p>