Facebook log-in is broken | Community
Skip to main content
New Participant
March 28, 2017
Solved

Facebook log-in is broken

  • March 28, 2017
  • 12 replies
  • 8302 views

Hey

Today facebook log-in on our web-site stopped working:

28.03.2017 10:54:52.313 *ERROR* [qtp1448280031-74010] com.adobe.granite.auth.oauth.impl.oauth2.Oauth2Helper Response body is incorrect. Can't extract a token from this: '{"access_token":"EAAJGDvtJEUYBANHEc5fdkYXLtAgDV6YHLcZCU87Rf7EPbTZAH05LqtAs1yZBXC3uLPDvpUpPMZCYEWLZCOdIksfObQ8Eu2gVibrZC1yr2lDvE5GeWt72S2Idsss7IbrhEIBNImkL78JAk82RpyMRCz5WdDMiDO2t8dPQdtINowNgZDZD","token_type":"bearer","expires_in":5112541}' org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract a token from this: '{"access_token":"EAAJGDvtJEUYBANHEc5fdkYXLtAgDV6YHLcZCU87Rf7EPbTZAH05LqtAs1yZBXC3uLPDvpUpPMZCYEWLZCOdIksfObQ8Eu2gVibrZC1yr2lDvE5GeWt72S2Idsss7IbrhEIBNImkL78JAk82RpyMRCz5WdDMiDO2t8dPQdtINowNgZDZD","token_type":"bearer","expires_in":5112541}' at org.scribe.extractors.TokenExtractor20Impl.extract(TokenExtractor20Impl.java:33) at org.scribe.oauth.OAuth20ServiceImpl.getAccessToken(OAuth20ServiceImpl.java:37) at com.adobe.granite.auth.oauth.impl.oauth2.Oauth2Helper.requestAccessCode(Oauth2Helper.java:124) at com.adobe.granite.auth.oauth.impl.OAuthAuthenticationHandler.extractCredentials(OAuthAuthenticationHandler.java:193) at org.apache.sling.auth.core.impl.AuthenticationHandlerHolder.doExtractCredentials(AuthenticationHandlerHolder.java:75) at org.apache.sling.auth.core.impl.AbstractAuthenticationHandlerHolder.extractCredentials(AbstractAuthenticationHandlerHolder.java:60) at org.apache.sling.auth.core.impl.SlingAuthenticator.getAuthenticationInfo(SlingAuthenticator.java:718) at org.apache.sling.auth.core.impl.SlingAuthenticator.doHandleSecurity(SlingAuthenticator.java:466) at org.apache.sling.auth.core.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:451) at org.apache.sling.engine.impl.SlingHttpContext.handleSecurity(SlingHttpContext.java:121) at org.apache.felix.http.base.internal.service.ServletContextImpl.handleSecurity(ServletContextImpl.java:421) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:57) at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:124) at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:61) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745)
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Stanleyor

If someone experiencing the same problem:

Finally after 2 weeks we got a hot-fix from Adobe.

The claim in docs that "AEM 6.2 Communities works with FB API 2.5" is a lie. You need a hot-fix to make it work.

12 replies

JK_Kendall
New Participant
March 28, 2017

What version of AEM and Communities are you using?   Social login is a feature of the Communities capability.

Please read about Facebook API versions from the AEM perspective.

- JK

StanleyorAuthor
New Participant
March 28, 2017

If I understand correctly that is what AEM uses:
https://github.com/dsyer/scribe-java/blob/master/src/main/java/org/scribe/extractors/TokenExtractor20Impl.java

 

public class TokenExtractor20Impl implements AccessTokenExtractor { private static final String TOKEN_REGEX = "access_token=([^&]+)"; private static final String EMPTY_SECRET = ""; /** * {@inheritDoc} */ public Token extract(String response) { Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string"); Matcher matcher = Pattern.compile(TOKEN_REGEX).matcher(response); if (matcher.find()) { String token = OAuthEncoder.decode(matcher.group(1)); return new Token(token, EMPTY_SECRET, response); } else { throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null); } } }

Although according to Facebook change log:

[Oauth Access Token] Format - The response format of https://www.facebook.com/v2.3/oauth/access_token returned when you exchange a code for an access_token now return valid JSON instead of being URL encoded. The new format of this response is {"access_token": {TOKEN}, "token_type":{TYPE}, "expires_in":{TIME}}. We made this update to be compliant with section 5.1 of RFC 6749.

Hence new JSON format cannot be parsed by old REGEX.

There is an example of an appropriate implementation here. But I do not know how to integrate this with AEM and whether that is possible at all.