Giter Club home page Giter Club logo

Comments (7)

martinduris avatar martinduris commented on June 26, 2024

confirm - same problem

from grails-spring-security-facebook.

kikeseiya avatar kikeseiya commented on June 26, 2024

Yes, it is same problem...

from grails-spring-security-facebook.

martinduris avatar martinduris commented on June 26, 2024

Hi, please upgrade to version 0.19 - author of this plugin already fix it there :-)

from grails-spring-security-facebook.

kikeseiya avatar kikeseiya commented on June 26, 2024

Hi, doesn't work because facebook 0.19 only works with Grails 3.x and Spring-Security-Core plugin 3.x.

Mi application work with Grails 2.4.4 and Spring Security Source 2.0 :(

from grails-spring-security-facebook.

martinduris avatar martinduris commented on June 26, 2024

@kikeseiya hmm, maybe there is need to create fork ?

from grails-spring-security-facebook.

kikeseiya avatar kikeseiya commented on June 26, 2024

I modified the code with the new facebook format and it works.

from grails-spring-security-facebook.

kikeseiya avatar kikeseiya commented on June 26, 2024

`FacebookAccessToken requestAccessToken(String authUrl) {
try {
URL url = new URL(authUrl)
String response = url.readLines().first()
println "AccessToken response: $response"
println response.split(',')
Map data = [:]
int i = 0
response.split(',').each { String part ->
part = part.replace(""", "")
if (i == 0) {
part = part.substring(1)
}

			if (i == 2) {
				part = part.substring(0, part.length() - 1)
			}
			
			i++
			println part
            String[] kv = part.split(':')
            if (kv.length != 2) {
                log.warn("Invalid response part: $part")
            } else {
				println kv[0] + " " + kv[1]
                data[kv[0]] = kv[1]
            }
        }
        FacebookAccessToken token = new FacebookAccessToken()
        if (data.access_token) {
            token.accessToken = data.access_token
        } else {
            log.error("No access_token in response: $response")
        }
        if (data.expires_in) {
            if (data.expires_in =~ /^\d+$/) {
                token.expireAt = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(data.expires_in as Long))
            } else {
                log.warn("Invalid 'expires' value: $data.expires")
            }
        } else {
          log.error("No expires in response: $response")
        }
        //log.debug("Got AccessToken: $token")
        return token
    } catch (IOException e) {
        //TODO process error response
        log.warn("Can't read data from Facebook", e)
        return null
    }
}`

from grails-spring-security-facebook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.