Source:
<code>protected abstract ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) throws Exception; protected void validate(HttpServletRequest request, HttpServletResponse response, Form form) { validateCsrfToken(request, response, form); if (request.getParameterMap().size() == 0 && request.getContentLength() > 0) { Map<String, Object> map = (Map<String, Object>) request.getAttribute(MARSHALLED_OBJECT); Map<String, String> providerData = (Map<String, String>) map.get("providerData"); if (providerData != null) { <START> ProviderAccountRequestBuilder requestBuilder = Providers.FACEBOOK.account(); <END> String accessToken = providerData.get("accessToken"); ProviderAccountRequest accountRequest = requestBuilder.setAccessToken(accessToken).build(); ProviderAccountResult result = ApplicationResolver.INSTANCE.getApplication(request).getAccount(accountRequest); if (result.getAccount().getStatus().equals(AccountStatus.ENABLED)) { request.setAttribute(Account.class.getName(), result.getAccount()); return; } } } List<Field> fields = form.getFields(); for (Field field : fields) { if (field.isRequired() || field.isEnabled()) { String value = form.getFieldValue(field.getName()); if (value == null) { String key = "stormpath.web." + controllerKey + ".form.fields." + field.getName() + ".required"; String msg = i18n(request, key); throw new ValidationException(msg); } } } if (isJsonPreferred(request, response)) { Map<String, Object> postedJsonFields = fieldValueResolver.getAllFields(request); for (String fieldName : postedJsonFields.keySet()) { if (form.getField(fieldName) == null && !"customData".equals(fieldName)) { String key = "stormpath.web.form.fields.unknown"; String msg = i18n(request, key, fieldName); throw new ValidationException(msg); } } } }</code><technical_language>check for providerId is support other providers this</technical_language>

Target:
protected abstract ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) throws Exception; protected void validate(HttpServletRequest request, HttpServletResponse response, Form form) { validateCsrfToken(request, response, form); if (request.getParameterMap().size() == 0 && request.getContentLength() > 0) { ProviderAccountRequest accountRequest = socialUtils.getAccountProviderRequest(request); if (accountRequest != null) { ProviderAccountResult result = ApplicationResolver.INSTANCE.getApplication(request).getAccount(accountRequest); Account account = result.getAccount(); if (account.getStatus().equals(AccountStatus.ENABLED)) { request.setAttribute(Account.class.getName(), account); return; } } } List<Field> fields = form.getFields(); for (Field field : fields) { if (field.isRequired() || field.isEnabled()) { String value = form.getFieldValue(field.getName()); if (value == null) { String key = "stormpath.web." + getControllerKey() + ".form.fields." + field.getName() + ".required"; String msg = i18n(request, key); throw new ValidationException(msg); } } } if (isJsonPreferred(request, response)) { Map<String, Object> postedJsonFields = fieldValueResolver.getAllFields(request); for (String fieldName : postedJsonFields.keySet()) { if (form.getField(fieldName) == null && !"customData".equals(fieldName)) { String key = "stormpath.web.form.fields.unknown"; String msg = i18n(request, key, fieldName); throw new ValidationException(msg); } } } }