<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)">Dear Marek,</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)">Because I don&#39;t want to redirect user to Keycloak&#39;s login page. </div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)">BTW: I was getting CORS error for refresh url as well so I added my origin in <a href="http://localhost:8080/auth/admin/master/console/#/realms/master/applications/d1f6f182-1a13-4e9d-bee7-8a2693d9fae9" class="" style="color:rgb(0,153,211);text-decoration:none;font-family:&#39;Open Sans&#39;,Helvetica,Arial,sans-serif;font-size:12px;line-height:20px;background-image:initial;background-repeat:initial">security-admin-console</a> application and its working now.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial;font-size:small"><span style="color:rgb(153,51,0);font-family:verdana,sans-serif"><div style="display:inline">​</div>Regards,</span><br style="color:rgb(153,51,0);font-family:verdana,sans-serif"><span style="color:rgb(153,51,0);font-family:verdana,sans-serif"><b><div style="display:inline">​​</div>Sadiq Khoja</b></span></div><div style="font-family:arial;font-size:small"><div style="font-family:verdana,sans-serif;color:rgb(153,51,0)"><br></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Apr 7, 2015 at 3:12 PM, Marek Posolda <span dir="ltr">&lt;<a href="mailto:mposolda@redhat.com" target="_blank">mposolda@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hi,<br>
      <br>
      the question is why you need Direct Grant Access in javascript
      application? I think it will be much better to use our javascript
      adapter and retrieve the access token with it:
<a href="http://docs.jboss.org/keycloak/docs/1.2.0.Beta1/userguide/html/ch08.html#javascript-adapter" target="_blank">http://docs.jboss.org/keycloak/docs/1.2.0.Beta1/userguide/html/ch08.html#javascript-adapter</a><br>
      <br>
      Marek<div><div class="h5"><br>
      <br>
      On 7.4.2015 10:24, Sadiq Khoja wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)">Guys,</div>
        <div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(153,51,0)"><br>
        </div>
        <div class="gmail_default"><font color="#993300" face="verdana, sans-serif">I want to enable CORS for Direct
            Grant Access, how to do it? I am getting following error
            from my javascript application:</font><br>
          <font color="#993300" face="verdana, sans-serif"><br>
          </font></div>
        <div class="gmail_default"><font color="#993300" face="verdana, sans-serif">(index):1 XMLHttpRequest cannot
            load <a href="http://localhost:8080/auth/realms/master/tokens/grants/access" target="_blank">http://localhost:8080/auth/realms/master/tokens/grants/access</a>.
            No &#39;Access-Control-Allow-Origin&#39; header is present on the
            requested resource. Origin &#39;<a href="http://pn.localhost:81" target="_blank">http://pn.localhost:81</a>&#39;
            is therefore not allowed access. The response had HTTP
            status code 400.</font><br>
        </div>
        <div class="gmail_default"><font color="#993300" face="verdana, sans-serif"><br>
          </font></div>
        <div class="gmail_default"><font color="#993300" face="verdana, sans-serif"><br>
          </font></div>
        <div>
          <div>
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div style="font-family:arial;font-size:small"><span style="color:rgb(153,51,0);font-family:verdana,sans-serif">
                      <div style="display:inline">​</div>
                      Regards,</span><br style="color:rgb(153,51,0);font-family:verdana,sans-serif">
                    <span style="color:rgb(153,51,0);font-family:verdana,sans-serif"><b>
                        <div style="display:inline">​​</div>
                        Sadiq Khoja</b></span></div>
                  <div style="font-family:arial;font-size:small">
                    <div style="font-family:verdana,sans-serif;color:rgb(153,51,0)"><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
keycloak-user mailing list
<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div>