title: Error trying to use OneLogin OIDC with SpringBoot (error: redirect_uri_mismatch)
body: <p>I've trying to connect OneLogin OIDC with SpringBoot for days now and I've not been able to yet.</p>
  
  <p>I'm very new with OIDC, so, maybe I missing something basic.</p>
  
  <p>I've followed these instructions in OpenLogin Administration panel:
  <a href="https://developers.onelogin.com/openid-connect/connect-to-onelogin" rel="nofollow noreferrer">https://developers.onelogin.com/openid-connect/connect-to-onelogin</a></p>
  
  <p>Tried the code in (master branch):
  <a href="https://github.com/onelogin/onelogin-oidc-java/tree/master/spring-boot-app" rel="nofollow noreferrer">https://github.com/onelogin/onelogin-oidc-java/tree/master/spring-boot-app</a></p>
  
  <p>And found out that there is a pull request of a few days ago in the same repository, with a very different solution (karson-demo-2019-oct branch):
  <a href="https://github.com/onelogin/onelogin-oidc-java/tree/karson-demo-2019-oct/spring-boot-app" rel="nofollow noreferrer">https://github.com/onelogin/onelogin-oidc-java/tree/karson-demo-2019-oct/spring-boot-app</a></p>
  
  <p>But unfortunately, the solution didn't work.</p>
  
  <p>I'm using the same code of karson-demo-2019-oct branch with only some added properties to the YAML file (please, see below)</p>
  
  <p>I'm configuring the redirect URI in the OneLogin Administration panel as <code>https://localhost:8081/</code>.
  Once I go to <code>https://localhost:8081/</code>, click on "click here", the following error appears:</p>
  
  <pre><code>oops! something went wrong
  error: redirect_uri_mismatch
  error_description: redirect_uri did not match any client's registered redirect_uris
  state: bi14wv
  </code></pre>
  
  <p>And the URL is something like:</p>
  
  <pre><code>https://openid-connect.onelogin.com/oidc/auth?client_id=XXXXXXXXXXXXXXXXXXXXXX&amp;redirect_uri=https://localhost:8081/login&amp;response_type=code&amp;scope=openid%20profile%20email&amp;state=bi14wv
  </code></pre>
  
  <p>If I add <code>https://localhost:8081/login</code> (with "login" in the end) to the list of Redirect URI's in the OneLogin Admin panel, the following happens:
  When I go to <code>https://localhost:8081/</code> and click on "click here", the OneLogin form appears. Then I login with my user, and then the following message appears:</p>
  
  <pre><code>Whitelabel Error Page
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  Tue Nov 05 15:32:02 PST 2019
  There was an unexpected error (type=Unauthorized, status=401).
  Unauthorized
  </code></pre>
  
  <p>And the url of this error page is something like:</p>
  
  <pre><code>https://localhost:8081/login?code=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&amp;state=ZZZZZ
  </code></pre>
  
  <p>As you can see there is a "login" after the specified redirect URI (<code>https://localhost:8081</code>), and I think this could be due to the way the <a href="https://github.com/onelogin/onelogin-oidc-java/blob/karson-demo-2019-oct/spring-boot-app/src/main/resources/static/index.html" rel="nofollow noreferrer">index.html</a> was written in the solution.</p>
  
  <p>Since the OneLogin portal doesn't accept Redirect URI's with http (only https), I needed to add a few more lines to the application.yml in order to enable SSL:</p>
  
  <pre><code>security:
    oauth2:
      client:
        clientId: XXXXXXXXXXXXXXXXXXXXXX
        clientSecret: XXXXXXXXXXXXXXXXXXXXX
        accessTokenUri: https://openid-connect.onelogin.com/oidc/token
        userAuthorizationUri: https://openid-connect.onelogin.com/oidc/auth
        tokenName: access_token
        authorizedGrantTypes: authorization_code
        authenticationScheme: form
        clientAuthenticationScheme: form
        scope: openid,profile,email
      resource:
        userInfoUri: https://openid-connect.onelogin.com/oidc/me
  
  server:
    port : 8081
    ssl:
      key-store-type: PKCS12
      key-store: classpath:XXXXXXXXXXXX
      key-store-password: XXXXXXXXXXXX
      key-alias: XXXXXXXXXXX
  </code></pre>
  
  <p>Is this correct?
  Could you please, help me find out what I am missing?</p>