title: URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web
body: <p>I am developing <code>spring-social-login</code> using <code>Spring Boot</code>. In this example, I have created <code>App</code> on the <a href="https://developers.facebook.com" rel="nofollow noreferrer">https://developers.facebook.com</a>. When I am trying to login using the Facebook into my application, I see the below error comes. Why ??</p>
  
  <pre><code>URL blocked: This redirect failed because the redirect URI is not white-listed
  in the app's client OAuth settings. Make sure that the client and web OAuth 
  logins are on and add all your app domains as valid OAuth redirect URIs.
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/onyqO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/onyqO.png" alt="enter image description here"></a></p>
  
  <p><strong>Facebook login setting:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/pGZIW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pGZIW.png" alt="enter image description here"></a></p>
  
  <p>And below is the <strong>App Review</strong> setting::</p>
  
  <p><strong>Setting:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/whqb9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/whqb9.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/qyd78.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qyd78.png" alt="enter image description here"></a></p>
  
  <p><strong>application.properties:</strong></p>
  
  <pre><code>spring.social.facebook.appId=970222193006255
  spring.social.facebook.appSecret=27aae52935369b43710e6e8bacXXXXXXX
  spring.thymeleaf.cache=false
  </code></pre>
  
  <p><strong>FacebookSignInAdapter</strong></p>
  
  <pre><code>@Service
  public class FacebookSignInAdapter implements SignInAdapter {
      @Override
      public String signIn(String localUserId, Connection&lt;?&gt; connection, NativeWebRequest request) {
          System.out.println(" ====== Sign In adapter");
          SecurityContextHolder.getContext().setAuthentication(
                  new UsernamePasswordAuthenticationToken(connection.getDisplayName(), 
                          null, 
                          Arrays.asList(new SimpleGrantedAuthority("FACEBOOK_USER"))));
          return null;
      }
  }
  </code></pre>
  
  <p><strong>FacebookConnectionSignup</strong></p>
  
  <pre><code>@Service
  public class FacebookConnectionSignup implements ConnectionSignUp {
  
      @Autowired
      private UserRepository userRepository;
  
      @Override
      public String execute(Connection&lt;?&gt; connection) {
          System.out.println("signup === ");
          final User user = new User();
          user.setUsername(connection.getDisplayName());
          user.setPassword(randomAlphabetic(8));
          userRepository.save(user);
          return user.getUsername();
      }
  }
  </code></pre>
  
  <p><strong>SecurityConfig</strong></p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  @ComponentScan(basePackages = { "org.baeldung.security" })
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Autowired
      private UserDetailsService userDetailsService;
  
      @Autowired
      private ConnectionFactoryLocator connectionFactoryLocator;
  
      @Autowired
      private UsersConnectionRepository usersConnectionRepository;
  
      @Autowired
      private FacebookConnectionSignup facebookConnectionSignup;
  
      @Override
      protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
          auth.userDetailsService(userDetailsService);
      }
  
      @Override
      protected void configure(final HttpSecurity http) throws Exception {
          // @formatter:off
          http
          .csrf().disable()
          .authorizeRequests()
          .antMatchers("/login*","/signin/**","/signup/**").permitAll()
          .anyRequest().authenticated()
          .and()
          .formLogin().loginPage("/login").permitAll()
          .and()
          .logout();
      } // @formatter:on
  
      @Bean
      // @Primary
      public ProviderSignInController providerSignInController() {
          ((InMemoryUsersConnectionRepository) usersConnectionRepository).setConnectionSignUp(facebookConnectionSignup);
          return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new FacebookSignInAdapter());
      }
  }
  </code></pre>
  
  <p><strong>WebConfig</strong></p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  public class WebConfig extends WebMvcConfigurerAdapter {
  
      @Bean
      public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
          return new PropertySourcesPlaceholderConfigurer();
      }
  
      @Override
      public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) {
          configurer.enable();
      }
  
      @Override
      public void addViewControllers(final ViewControllerRegistry registry) {
          super.addViewControllers(registry);
          registry.addViewController("/").setViewName("forward:/index");
          registry.addViewController("/index");
          registry.addViewController("/login");
      }
  
      @Override
      public void addResourceHandlers(final ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
      }
  }
  </code></pre>