aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/FacebookLogin.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/FacebookLogin.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/FacebookLogin.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/juick-www/src/main/java/com/juick/www/FacebookLogin.java b/juick-www/src/main/java/com/juick/www/FacebookLogin.java
index e9c4b786..1dcbb39f 100644
--- a/juick-www/src/main/java/com/juick/www/FacebookLogin.java
+++ b/juick-www/src/main/java/com/juick/www/FacebookLogin.java
@@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.server.UserQueries;
import com.juick.www.facebook.Graph;
+import org.apache.commons.lang3.CharEncoding;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
@@ -69,7 +70,7 @@ public class FacebookLogin {
response.addCookie(c);
response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
- response.setHeader("Location", "https://www.facebook.com/dialog/oauth?scope=publish_stream&client_id=" + FACEBOOK_APPID + "&redirect_uri=" + URLEncoder.encode(FACEBOOK_REDIRECT, "utf-8") + "&state=" + fbstate);
+ response.setHeader("Location", "https://www.facebook.com/dialog/oauth?scope=publish_stream&client_id=" + FACEBOOK_APPID + "&redirect_uri=" + URLEncoder.encode(FACEBOOK_REDIRECT, CharEncoding.UTF_8) + "&state=" + fbstate);
return;
}
@@ -83,7 +84,7 @@ public class FacebookLogin {
response.addCookie(c);
}
- String token = Utils.fetchURL("https://graph.facebook.com/oauth/access_token?client_id=" + FACEBOOK_APPID + "&redirect_uri=" + URLEncoder.encode(FACEBOOK_REDIRECT, "utf-8") + "&client_secret=" + FACEBOOK_SECRET + "&code=" + URLEncoder.encode(code, "utf-8"));
+ String token = Utils.fetchURL("https://graph.facebook.com/oauth/access_token?client_id=" + FACEBOOK_APPID + "&redirect_uri=" + URLEncoder.encode(FACEBOOK_REDIRECT, CharEncoding.UTF_8) + "&client_secret=" + FACEBOOK_SECRET + "&code=" + URLEncoder.encode(code, CharEncoding.UTF_8));
if (token == null || token.isEmpty() || !token.startsWith("access_token=")) {
logger.error("FACEBOOK TOKEN ERROR: {}", token);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);