agorapulse / grails-facebook-sdk

Facebook SDK Grails Plugin
http://agorapulse.github.com/grails-facebook-sdk/guide
30 stars 13 forks source link

Facebook JS Error #24

Closed confile closed 11 years ago

confile commented 11 years ago

I use your plugin in version 0.4.6 and I get the following error when running the app in the browser console:

Uncaught SyntaxError: Unexpected token . all.js:93

Do you have any idea on how to fix it?

benorama commented 11 years ago

It looks like a Facebook bug: all.js is provided by Facebook JS SDK. How do you have this problem?

confile commented 11 years ago

The login function works fine. The only problem occurs when I include this:

<facebook:initJS
        appId="${facebookContext.app.id}"
        xfbml="${true}" />

Do you have any idea how to fix it?

benorama commented 11 years ago

Can you check the code source of your page? You should have something like this:

(function() {
        var e = document.createElement("script");
        e.src = document.location.protocol + "//connect.facebook.net/en_US/all.js";
        e.async = true;
        document.getElementById("fb-root").appendChild(e);
    }());

Check the locale, by default, it's _enUS .

It will release next week a new version of the SDK that will check if the locale is supported by Facebook (they support around 70 locales, but not all of them).

confile commented 11 years ago

I have this:

    (function() {
        var e = document.createElement("script");
        e.src = document.location.protocol + "//connect.facebook.net/de_DE/all.js";
        e.async = true;
        document.getElementById("fb-root").appendChild(e);
    }());

I worked before fine. But not anymore.

benorama commented 11 years ago

What is your grails config for this app? Especially the permissions param?

Le 13 déc. 2012 à 09:50, "Michael G." notifications@github.com a écrit :

I have this:

(function() {
    var e = document.createElement("script");
    e.src = document.location.protocol + "//connect.facebook.net/de_DE/all.js";
    e.async = true;
    document.getElementById("fb-root").appendChild(e);
}());

I worked before fine. But not anymore.

— Reply to this email directly or view it on GitHub.

confile commented 11 years ago
// locations to search for config files that get merged into the main config
// config files can either be Java properties files or ConfigSlurper scripts

// grails.config.locations = [ "classpath:${appName}-config.properties",
//                             "classpath:${appName}-config.groovy",
//                             "file:${userHome}/.grails/${appName}-config.properties",
//                             "file:${userHome}/.grails/${appName}-config.groovy"]

// if (System.properties["${appName}.config.location"]) {
//    grails.config.locations << "file:" + System.properties["${appName}.config.location"]
// }

grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format
grails.mime.use.accept.header = false
grails.mime.types = [ html: [
        'text/html',
        'application/xhtml+xml'
    ],
    xml: [
        'text/xml',
        'application/xml'
    ],
    text: 'text/plain',
    js: 'text/javascript',
    rss: 'application/rss+xml',
    atom: 'application/atom+xml',
    css: 'text/css',
    csv: 'text/csv',
    all: '*/*',
    json: [
        'application/json',
        'text/json'
    ],
    form: 'application/x-www-form-urlencoded',
    multipartForm: 'multipart/form-data',
    svg: 'image/svg+xml',
    png: 'image/png',
    jpeg: 'image/jpeg',
    jpg: 'image/jpg'
]

// URL Mapping Cache Max Size, defaults to 5000
//grails.urlmapping.cache.maxsize = 1000

// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = [
    //'/images/*',
    //'/css/*',
    '/js/*',
    '/plugins/*'
]

// for JQuery
grails.views.javascript.library="jquery"

// The default codec used to encode data with ${}
grails.views.default.codec = "none" // none, html, base64
grails.views.gsp.encoding = "UTF-8"
grails.converters.encoding = "UTF-8"
// enable Sitemesh preprocessing of GSP pages
grails.views.gsp.sitemesh.preprocess = true
// scaffolding templates configuration
grails.scaffolding.templates.domainSuffix = 'Instance'

// Set to false to use the new Grails 1.2 JSONBuilder in the render method
grails.json.legacy.builder = false
// enabled native2ascii conversion of i18n properties files
grails.enable.native2ascii = true
// packages to include in Spring bean scanning
grails.spring.bean.packages = []
// whether to disable processing of multi part requests
grails.web.disable.multipart=false

// request parameters to mask when logging exceptions
grails.exceptionresolver.params.exclude = ['password']

// enable query caching by default
grails.hibernate.cache.queries = true

// set per-environment serverURL stem for creating absolute links
environments {
    development {

    }
    production {
        grails.logging.jul.usebridge = false
        grails.serverURL = "http://www.mydomain.com"
        grails.serverName = "www.mydomain.com"
    }
}

// log4j configuration
log4j = {
    // Example of changing the log pattern for the default console
    // appender:
    //
    //appenders {
    //    console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
    //}

    info 'com.mydomain', 'org.eclipse.jetty'

    error 'org.codehaus.groovy.grails.web.servlet',  //  controllers
            'org.codehaus.groovy.grails.web.pages', //  GSP
            'org.codehaus.groovy.grails.web.sitemesh', //  layouts
            'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
            'org.codehaus.groovy.grails.web.mapping', // URL mapping
            'org.codehaus.groovy.grails.commons', // core / classloading
            'org.codehaus.groovy.grails.plugins', // plugins
            'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
            'org.springframework',
            'org.hibernate',
            'net.sf.ehcache.hibernate'
}

// Added by the Spring Security Core plugin:
grails.plugins.springsecurity.userLookup.userDomainClassName = 'com.mydomain.User'
grails.plugins.springsecurity.userLookup.authorityJoinClassName = 'com.mydomain.UserRole'
grails.plugins.springsecurity.authority.className = 'com.mydomain.Role'
grails.plugins.springsecurity.useSessionFixationPrevention = true
//grails.plugins.springsecurity.successHandler.defaultTargetUrl = '/app/?auth_source=login'

// disable GWT files when dealing with static resources
grails.resources.adhoc.excludes = ['**/gwt/**']

environments {
    development {
        grails.plugin.facebooksdk.appId = xxxxx
        grails.plugin.facebooksdk.appPermissions = "email" 
        grails.plugin.facebooksdk.appSecret = "xxxxx"

    }
    production {

        grails.plugin.facebooksdk.appId = xxxxxx
        grails.plugin.facebooksdk.appPermissions = "email"
        grails.plugin.facebooksdk.appSecret = "xxxxxx"

    }
}

grails.resources.modules = {
    application { resource url:'/js/application.js' }
}
benorama commented 11 years ago

Try to change the following:

appPermissions = "email"

To

appPermissions = ['email']
confile commented 11 years ago

It is working now without the changes.