Is it anything in the server.log when you unsuccessfully invoke the endpoint?

It seems the error is that you are invoking endpoint without Keycloak access token. If you look at the facebook broker example, there is also the interceptor "authInterceptor" which is supposed to add the Authorization header with keycloak bearer token to the REST request, which is sent to keycloak. Do you have this in your application?

Marek

On 29/04/16 14:17, JAYAPRIYA ATHEESAN wrote:

I have set the web origin, even then it is not going through.

'http://ds412.projectstatus.co.uk

 

 

 

Thanks,

Jayapriya Atheesan

 

From: Marek Posolda [mailto:mposolda@redhat.com]
Sent: Friday, April 29, 2016 5:42 PM
To: JAYAPRIYA ATHEESAN; keycloak-user@lists.jboss.org
Subject: Re: [keycloak-user] Problem in getting access token from facebook identity provider

 

Do you have "Web origins" set for your client? You can set in keycloak admin console.

Marek

On 29/04/16 12:46, JAYAPRIYA ATHEESAN wrote:

Hi All,

 

I’m facing issue in getting access token from facebook identity provider.

 

This is the code I’m using for fetching the access token, but the method doesn’t succeed.

 

$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('&'));

 

            $http.get('https://graph.facebook.com/me?access_token=' + accessToken)

                .success(function(profile) {

                    $scope.socialProfile = profile;

                })

                .error(function(data, status, headers, config) {

                    $scope.socialProfile = 'Could not obtain social profile. Trying to refresh your token.';

                    Auth.refreshToken();

                });

        });

 

 

Below is the exception I’m facing.

 

XMLHttpRequest cannot load https://<host_name>:8444/auth/realms/giggzo/broker/facebook/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://ds412.projectstatus.co.uk' is therefore not allowed access. The response had HTTP status code 400.

 

 

PLEASE HELP ME IN RESOLVING THE ISSUE.

Thanks,

Jayapriya Atheesan

 




_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user