Skip to content

Commit

Permalink
print the FB JSON error message
Browse files Browse the repository at this point in the history
If the HTTP GET to https://graph.facebook.com/oauth/access_token fails,
the plugin will print the error message...
  • Loading branch information
ph4t committed Jun 12, 2013
1 parent 624fc05 commit 784a3c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SpringSecurityFacebookGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.the6hours.grails.springsecurity.facebook.FacebookAuthRedirectFilter

class SpringSecurityFacebookGrailsPlugin {

String version = '0.14.5pg2'
String version = '0.14.5pg4'

String grailsVersion = '2.0.0 > *'
Map dependsOn = ['springSecurityCore': '1.2.7.2 > *']
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<plugin name='spring-security-facebook' version='0.14.5pg2' grailsVersion='2.0.0 &gt; *'>
<plugin name='spring-security-facebook' version='0.14.5pg4' grailsVersion='2.0.0 &gt; *'>
<author>Igor Artamonov</author>
<authorEmail>igor@artamonov.ru</authorEmail>
<title>Facebook Authentication for Spring Security</title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,21 @@ class FacebookAuthUtils {

FacebookAccessToken requestAccessToken(String authUrl) {
try {
log.debug "Getting the access token for URL $authUrl"
URL url = new URL(authUrl)
String response = url.readLines().first()
//println "AccessToken response: $response"
HttpURLConnection connection = (HttpURLConnection) url.openConnection()
String response
if (connection.responseCode == HttpURLConnection.HTTP_OK){
response = connection.getInputStream().readLines().first()
}else{
String error = connection.getErrorStream().getText()
log.error "Failed to get the access token when requesting $authUrl. Error is $error"
return null
}


log.debug "AccessToken response: $response"

Map data = [:]
response.split('&').each {
String[] kv = it.split('=')
Expand Down

0 comments on commit 784a3c9

Please sign in to comment.