title: How to get Linkedin OAuth working in Spring Boot
body: <p>Need help to have <code>Login with Linkedin</code> in a <code>Spring boot 2.1.6.RELEASE</code> project with Spring OAuth2. Java version is 11 </p>
  
  <p>Google and Github are pretty straightforward and work in the same project. I tried a couple of sample codes in Spring-Social but they failed due to different Spring boot version.</p>
  
  <p>Below application.properties does not work (also tried <code>client-authentication-method=post</code>), and gets redirected back after authorization code is retrieved from linkedin (authorization code is valid, with which I can get access token from Postman). </p>
  
  <pre><code>spring.security.oauth2.client.registration.linkedin.provider=linkedin
  spring.security.oauth2.client.registration.linkedin.client-name=Linkedin
  spring.security.oauth2.client.registration.linkedin.client-id=******
  spring.security.oauth2.client.registration.linkedin.client-secret=******
  spring.security.oauth2.client.registration.linkedin.redirect-uri=*****
  spring.security.oauth2.client.registration.linkedin.authorization-grant-type=authorization_code
  spring.security.oauth2.client.registration.linkedin.client-authentication-method=form
  spring.security.oauth2.client.registration.linkedin.scope=r_emailaddress,r_liteprofile
  spring.security.oauth2.client.provider.linkedin.authorization-uri=https://www.linkedin.com/oauth/v2/authorization
  spring.security.oauth2.client.provider.linkedin.token-uri=https://www.linkedin.com/oauth/v2/accessToken
  spring.security.oauth2.client.provider.linkedin.user-info-uri=https://api.linkedin.com/v2/me
  spring.security.oauth2.client.provider.linkedin.user-info-authentication-method=post
  </code></pre>
  
  <p>SecurityConfig class (Also tried without <code>antMatchers</code>):</p>
  
  <pre><code>@Configuration
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.authorizeRequests().antMatchers("*linkedin*").permitAll()
                  .anyRequest().authenticated()
                  .and()
                  .csrf().disable()
                  .oauth2Login();
      }
  </code></pre>
  
  <p>There is no error, and after <code>code</code> query parameter is returned back to Spring along with <code>state</code>, it gets redirected back to Spring login.</p>
  
  <p>Thanks</p>