<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Is it anything in the server.log when
      you unsuccessfully invoke the endpoint?<br>
      <br>
      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?<br>
      <br>
      Marek<span style="color:#008000;font-weight:bold;"><br>
      </span>
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <br>
      On 29/04/16 14:17, JAYAPRIYA ATHEESAN wrote:<br>
    </div>
    <blockquote
      cite="mid:572350c3.e3a0420a.b16af.ffffc0b1@mx.google.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D">I have set the
            web origin, even then it is not going through.<o:p></o:p></span></p>
        <p class="MsoNormal">'<a moz-do-not-send="true"
            href="http://ds412.projectstatus.co.uk">http://ds412.projectstatus.co.uk</a><o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><span style="color:#1F497D"><img
              id="Picture_x0020_2"
              src="cid:part2.09000503.04060607@redhat.com" border="0"
              height="37" width="557"></span><span style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <p class="MsoNormal"><span style="color:#1F497D">Thanks,<o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;color:#1F497D">Jayapriya Atheesan</span><span
              style="color:#1F497D"><o:p></o:p></span></p>
        </div>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext">
                Marek Posolda [<a class="moz-txt-link-freetext" href="mailto:mposolda@redhat.com">mailto:mposolda@redhat.com</a>] <br>
                <b>Sent:</b> Friday, April 29, 2016 5:42 PM<br>
                <b>To:</b> JAYAPRIYA ATHEESAN;
                <a class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
                <b>Subject:</b> Re: [keycloak-user] Problem in getting
                access token from facebook identity provider<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">Do you have "Web origins" set for your
            client? You can set in keycloak admin console.<br>
            <br>
            Marek<br>
            <br>
            On 29/04/16 12:46, JAYAPRIYA ATHEESAN wrote:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal">Hi All,<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">I’m facing issue in getting access token
            from facebook identity provider.<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">This is the code I’m using for fetching
            the access token, but the method doesn’t succeed.<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">$http.get('/auth/realms/facebook-identity-provider-realm/broker/facebook/token').success(function(data)
            {<o:p></o:p></p>
          <p class="MsoNormal">            var accessTokenParameter =
            'access_token=';<o:p></o:p></p>
          <p class="MsoNormal">            var accessToken =
            data.substring(data.indexOf(accessTokenParameter) +
            accessTokenParameter.length, data.indexOf('&amp;'));<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">            $http.get('<a
              moz-do-not-send="true"
              href="https://graph.facebook.com/me?access_token="><a class="moz-txt-link-freetext" href="https://graph.facebook.com/me?access_token=">https://graph.facebook.com/me?access_token=</a></a>'
            + accessToken)<o:p></o:p></p>
          <p class="MsoNormal">               
            .success(function(profile) {<o:p></o:p></p>
          <p class="MsoNormal">                    $scope.socialProfile
            = profile;<o:p></o:p></p>
          <p class="MsoNormal">                })<o:p></o:p></p>
          <p class="MsoNormal">                .error(function(data,
            status, headers, config) {<o:p></o:p></p>
          <p class="MsoNormal">                    $scope.socialProfile
            = 'Could not obtain social profile. Trying to refresh your
            token.';<o:p></o:p></p>
          <p class="MsoNormal">                    Auth.refreshToken();<o:p></o:p></p>
          <p class="MsoNormal">                });<o:p></o:p></p>
          <p class="MsoNormal">        });<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">Below is the exception I’m facing.<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">XMLHttpRequest cannot load <a
              moz-do-not-send="true" href="https://"><a class="moz-txt-link-freetext" href="https://">https://</a></a>&lt;host_name&gt;:8444/auth/realms/giggzo/broker/facebook/token.
            No 'Access-Control-Allow-Origin' header is present on the
            requested resource. Origin '<a moz-do-not-send="true"
              href="http://ds412.projectstatus.co.uk">http://ds412.projectstatus.co.uk</a>'
            is therefore not allowed access. The response had HTTP
            status code 400.<o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal">PLEASE HELP ME IN RESOLVING THE ISSUE.<o:p></o:p></p>
          <p class="MsoNormal">Thanks,<o:p></o:p></p>
          <p class="MsoNormal"><span style="font-size:12.0pt">Jayapriya
              Atheesan</span><o:p></o:p></p>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:&quot;Times New
              Roman&quot;,&quot;serif&quot;"><br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>keycloak-user mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:&quot;Times New
            Roman&quot;,&quot;serif&quot;"><o:p> </o:p></span></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>