Search code examples
grails-spring-security

grails-spring-security-rest OAuth OAuthException: Response body is incorrect


The plugin throws the following error when trying to sign in with facebook.

error:500, message:org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract a token from this: '{"access_token":"EAAOWKGC6MDcBAB9ZAka1zEc1","token_type":"bearer"}', error_description:org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract a token from this: '{"access_token":"EAAOWKGC6M","token_type":"bearer"}', error_code:OAuthException


Solution

  • I solved this problem customizing the Facebookclient. (workarround) bug details: https://github.com/alvarosanchez/grails-spring-security-rest/issues/327

    Put files in your src/main/groovy, (recommend create other package src/main/groovy/springSecurity)

    Files: https://gist.github.com/sergioz95/1266c2a29b4d00094fe18423b350aa34

    and reference the new facebookClient in application.groovy

    grails {
      plugin {
        springsecurity {
            rest {
                oauth {
                    facebook {
                        client = YOUR_PACKAGE.FacebookClient
                        ....
    

    Note: you can change the facebook url(because already is used 2.2)