From d3e75084de8ed48970808281ba1a1aca03a3ab15 Mon Sep 17 00:00:00 2001 From: mposolda Date: Tue, 17 Mar 2015 10:09:14 +0100 Subject: [PATCH] Fix broker packaging and facebook example --- .../org/keycloak/keycloak-broker-core/main/module.xml | 1 + .../org/keycloak/keycloak-broker-oidc/main/module.xml | 4 ++++ examples/broker/facebook-authentication/README.md | 4 +++- .../facebook-identity-provider-realm.json | 6 ++++++ .../facebook-authentication/src/main/webapp/js/app.js | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-core/main/module.xml b/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-core/main/module.xml index 4d48a6e880..870ffccb5b 100755 --- a/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-core/main/module.xml +++ b/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-core/main/module.xml @@ -9,6 +9,7 @@ + diff --git a/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-oidc/main/module.xml b/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-oidc/main/module.xml index e2cac38839..4f14840f51 100755 --- a/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-oidc/main/module.xml +++ b/distribution/modules/src/main/resources/modules/org/keycloak/keycloak-broker-oidc/main/module.xml @@ -10,6 +10,10 @@ + + + + diff --git a/examples/broker/facebook-authentication/README.md b/examples/broker/facebook-authentication/README.md index df321b8794..ed9b7feda6 100644 --- a/examples/broker/facebook-authentication/README.md +++ b/examples/broker/facebook-authentication/README.md @@ -31,7 +31,9 @@ Make sure you've set up a application in Facebook This example application requires you to create a Facebook Application. How to create it is beyond the scope of this documentation. -Please take a look on [Facebook Developer Console](https://developers.facebook.com/apps/) for more details. +Please take a look on [Facebook Developer Console](https://developers.facebook.com/apps/) for more details. Make sure to use the correct +redirect URI to be used as URL on Facebook. The facebook will redirect to this URI after finish authentication. For this example, it's the URL +[http://localhost:8080/auth/realms/facebook-identity-provider-realm/broker/facebook](http://localhost:8080/auth/realms/facebook-identity-provider-realm/broker/facebook) . Once you have a Facebook Application configured, you need to obtain both **App ID** and **App Secret** and update the **facebook-identity-provider-realm.json** configuration file with these information. There you'll find a section as follows: diff --git a/examples/broker/facebook-authentication/facebook-identity-provider-realm.json b/examples/broker/facebook-authentication/facebook-identity-provider-realm.json index 5243879de2..2c90dad441 100644 --- a/examples/broker/facebook-authentication/facebook-identity-provider-realm.json +++ b/examples/broker/facebook-authentication/facebook-identity-provider-realm.json @@ -42,6 +42,12 @@ ], "webOrigins": [ "http://localhost:8080" + ], + "identityProviders": [ + { + "id": "facebook", + "retrieveToken": true + } ] } ], diff --git a/examples/broker/facebook-authentication/src/main/webapp/js/app.js b/examples/broker/facebook-authentication/src/main/webapp/js/app.js index 07ba17729f..3a8feebb07 100755 --- a/examples/broker/facebook-authentication/src/main/webapp/js/app.js +++ b/examples/broker/facebook-authentication/src/main/webapp/js/app.js @@ -83,7 +83,7 @@ module.controller('GlobalCtrl', function($scope, $http, $location, Auth) { $scope.identity = Auth.getIdentity(); $scope.loadSocialProfile = function() { - $http.get('http://localhost:8081/auth/realms/facebook-identity-provider-realm/broker/facebook/token').success(function(data) { + $http.get('/auth/realms/facebook-identity-provider-realm/broker/facebook/token').success(function(data) { var accessTokenParameter = 'access_token='; var accessToken = data.substring(data.indexOf(accessTokenParameter) + accessTokenParameter.length, data.indexOf('&'));