title: authorizationGrantType cannot be null in Spring Security 5 OAuth Client and Spring Boot 2.0
body: <p>I followed the Spring Security 5.0 official reference documentation and sample codes <a href="https://github.com/spring-projects/spring-security/tree/master/samples/boot/oauth2login" rel="nofollow noreferrer">oauth2login</a> to setup OAuth2/OIDC authentication in my project, but it failed and I got the following exception when I booted up my application by <code>mvn spring-boot:run</code>.</p>
  <pre class="lang-sh prettyprint-override"><code>    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' 
      defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientRegistrationRepositoryConfiguration.class]: 
      Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: 
      Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: 
      Factory method 'clientRegistrationRepository' threw exception; 
      nested exception is java.lang.IllegalArgumentException: authorizationGrantType cannot be null
  </code></pre>
  <p>I was using the default configuration provided by Spring Boot and just added some basic dependencies into projects, such as <code>spring-security-config</code>, <code>spring-security-oauth2-client</code>, <code>spring-security-oauth2-jsoe</code> etc.</p>
  <p><strong>Updated:</strong></p>
  <p><strong>I've found the reason</strong>, for custom OAuth2 providers, such as <strong>Gitlab</strong>,  I have to add <strong>grant type</strong>, <strong>redirectUritemplate</strong>, <strong>scope</strong>, <strong>clientName</strong> etc, but OpenID Connect specification has a configuration endpoint protocol, eg: <a href="https://gitlab.com/.well-known/openid-configuration" rel="nofollow noreferrer">https://gitlab.com/.well-known/openid-configuration</a> , is there possible to make Spring Security read this info automatically?</p>
  <p><strong>Update(5/15/2021):</strong> in the latest Spring Security 5.4 and Spring Boot 2.4, the OpenId configuration(<code>.well-known/openid-configuration</code>) is discovered by default, for most oauth2/oidc authorization servers, configure a
  <code>issuer_uri</code> is enough.</p>