[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wsf-c-dev
Subject:    Re: [Dev] Invalid Authorization Grant on IS 5.0.0 with authorization code grant type
From:       Chan <dulitha () wso2 ! com>
Date:       2014-05-30 16:45:45
Message-ID: CA+xRT_Zsfcp3+KoHjKJu23brcfVsGO__ocg3xks9+bzc3G2mwg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks Darshana. It works when sending the same redirect_uri.


On Thu, May 29, 2014 at 6:58 PM, Darshana Gunawardana <darshana@wso2.com>
wrote:

> Hi Chan,
> 
> Between two requests, redirect_uri got changed..  Can you please try
> calling token endpoint using the same redirect_uri used to get
> authorization code..
> 
> Thanks,
> 
> 
> On Fri, May 30, 2014 at 4:49 AM, Chan <dulitha@wso2.com> wrote:
> 
> > Hi Johann/Darshana,
> > I am trying to test a sample jaggery app with authorization code grant
> > type OAuth. I am testing this on IS 5.0.0 pack. I added a Service Provider
> > and enabled OAuth 2.0 authenticator for it.
> > 
> > Below is the first call I make to the IS -
> > 
> > *https://localhost:9443/oauth2/authorize?response_type=code&client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&redirect_uri=https://localhost:9444/coffee_shop/auth
> >  <https://localhost:9443/oauth2/authorize?response_type=code&client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&redirect_uri=https://localhost:9444/coffee_shop/auth>*
> >  
> > 
> > I get a token to the https://localhost:9444/coffee_shop/auth.  I get a
> > query string of '*code=fec75d85ce706e8a276519fc63f7aa*'. I then send
> > another request to the token end point like below -
> > 
> > *https://localhost:9443/oauth2/token?grant_type=authorization_code&code=fec75d85ce \
> > 706e8a276519fc63f7aa&redirect_uri=https://localhost:9444/coffee_shop/bam.jag&client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&client_secret=TGD7VTCPaE9cfNpM19fm9un2J3Ea
> >  <https://localhost:9443/oauth2/token?grant_type=authorization_code&code=fec75d85c \
> > e706e8a276519fc63f7aa&redirect_uri=https://localhost:9444/coffee_shop/bam.jag&client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&client_secret=TGD7VTCPaE9cfNpM19fm9un2J3Ea>*
> >  
> > 
> > I am getting
> > 
> > {
> > 
> > - error: "invalid_grant",
> > - error_description: "Provided Authorization Grant is invalid."
> > 
> > }
> > 
> > What could the problem be?
> > 
> > Cheers~
> > --
> > Chan (Dulitha Wijewantha)
> > Software Engineer - Mobile Development
> > WSO2Mobile
> > Lean.Enterprise.Mobileware
> > * ~Email       dulitha@wso2.com <dulitha@wso2mobile.com>*
> > *  ~Mobile     +94712112165 <%2B94712112165>*
> > *  ~Website   dulitha.me <http://dulitha.me>*
> > *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
> > *~Github     @dulichan <https://github.com/dulichan>*
> > *~SO     @chan <http://stackoverflow.com/users/813471/chan>*
> > 
> 
> 
> 
> --
> Regards,
> 
> 
> *Darshana Gunawardana *Software Engineer
> WSO2 Inc.; http://wso2.com
> 
> * E-mail: darshana@wso2.com <darshana@wso2.com>*
> *Mobile: +94718566859 <%2B94718566859> *Lean . Enterprise . Middleware
> 



-- 
Chan (Dulitha Wijewantha)
Software Engineer - Mobile Development
WSO2Mobile
Lean.Enterprise.Mobileware
 * ~Email       dulitha@wso2.com <dulitha@wso2mobile.com>*
*  ~Mobile     +94712112165*
*  ~Website   dulitha.me <http://dulitha.me>*
*  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
  *~Github     @dulichan <https://github.com/dulichan>*
  *~SO     @chan <http://stackoverflow.com/users/813471/chan>*


[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_default" \
style="font-family:tahoma,sans-serif">Thanks Darshana. It works when sending the same \
redirect_uri.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On \
Thu, May 29, 2014 at 6:58 PM, Darshana Gunawardana <span dir="ltr">&lt;<a \
href="mailto:darshana@wso2.com" target="_blank">darshana@wso2.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 dir="ltr">Hi Chan,<div><br></div><div>Between two \
requests, redirect_uri got changed..   Can you please try calling token endpoint \
using the same redirect_uri used to get authorization code..</div> \
<div><br></div><div>Thanks,</div>


<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On \
Fri, May 30, 2014 at 4:49 AM, Chan <span dir="ltr">&lt;<a \
href="mailto:dulitha@wso2.com" target="_blank">dulitha@wso2.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 dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi \
Johann/Darshana,</div><div class="gmail_default" \
style="font-family:tahoma,sans-serif">I am trying to test a sample jaggery app with \
authorization code grant type OAuth. I am testing this on IS 5.0.0 pack. I added a \
Service Provider and enabled OAuth 2.0 authenticator for it.</div>




<div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div \
class="gmail_default" style="font-family:tahoma,sans-serif">Below is the first call I \
make to the IS -</div><div class="gmail_default" \
style="font-family:tahoma,sans-serif">




<br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div \
class="gmail_default" style="font-family:tahoma,sans-serif"><div \
class="gmail_default"><i><a \
href="https://localhost:9443/oauth2/authorize?response_type=code&amp;client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&amp;redirect_uri=https://localhost:9444/coffee_shop/auth" \
target="_blank">https://localhost:9443/oauth2/authorize?response_type=code&amp;client_ \
id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&amp;redirect_uri=https://localhost:9444/coffee_shop/auth</a></i></div>





</div></blockquote><div class="gmail_default" \
style="font-family:tahoma,sans-serif"><div class="gmail_default"><br></div><div \
class="gmail_default">I get a token to the <a \
href="https://localhost:9444/coffee_shop/auth" \
target="_blank">https://localhost:9444/coffee_shop/auth</a>.   I get a query string \
of &#39;<i>code=fec75d85ce706e8a276519fc63f7aa</i>&#39;. I then send another request \
to the token end point like below -</div>




</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div \
class="gmail_default"><div class="gmail_default"><div class="gmail_default"><font \
face="tahoma, sans-serif"><i><a \
href="https://localhost:9443/oauth2/token?grant_type=authorization_code&amp;code=fec75 \
d85ce706e8a276519fc63f7aa&amp;redirect_uri=https://localhost:9444/coffee_shop/bam.jag& \
amp;client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&amp;client_secret=TGD7VTCPaE9cfNpM19fm9un2J3Ea" \
target="_blank">https://localhost:9443/oauth2/token?grant_type=authorization_code&amp; \
code=fec75d85ce706e8a276519fc63f7aa&amp;redirect_uri=https://localhost:9444/coffee_sho \
p/bam.jag&amp;client_id=u8iH1rbGrygWsXPDIA_0wlpGt7Aa&amp;client_secret=TGD7VTCPaE9cfNpM19fm9un2J3Ea</a></i></font><br>





</div></div></div></blockquote><div class="gmail_default" \
style="font-family:tahoma,sans-serif"><div class="gmail_default"><div \
class="gmail_default"><br></div><div class="gmail_default">I am getting  </div><div \
class="gmail_default">




<br></div><div class="gmail_default"><span \
style="color:rgb(0,0,0);font-family:monospace;font-size:medium">{</span><ul \
style="list-style-type:none;padding:0px;margin:0px 0px 0px \
2em;color:rgb(0,0,0);font-family:monospace;font-size:medium">




<li><div style="display:inline-block;padding:1px \
2px;border-top-left-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:2px"><span \
style="font-weight:bold">error</span>:  <span \
style="color:green">&quot;invalid_grant&quot;</span>,</div>




</li><li><div style="display:inline-block;padding:1px \
2px;border-top-left-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px;border-bottom-left-radius:2px;background-color:rgb(235,238,249)"><span \
style="font-weight:bold">error_description</span>:  <span \
style="color:green">&quot;Provided Authorization Grant is invalid.&quot;</span></div>




</li></ul><span style="color:rgb(0,0,0);font-family:monospace;font-size:medium">}</span></div><div \
class="gmail_default"><br></div><div class="gmail_default">What could the problem \
be?</div><div class="gmail_default"><br>




</div><div class="gmail_default">Cheers~</div></div></div><span><font \
color="#888888">-- <br><div dir="ltr"><div \
style="font-size:small;font-family:tahoma,sans-serif"> <div>Chan (Dulitha Wijewantha) \
<br>Software Engineer - Mobile Development<br></div><div>WSO2Mobile  \
<br></div><div>Lean.Enterprise.Mobileware<br></div></div><div \
style="font-size:small;font-family:tahoma,sans-serif">  <i>  ~Email            <a \
href="mailto:dulitha@wso2mobile.com" style="color:rgb(17,85,204)" \
target="_blank">dulitha@wso2.com</a></i></div>





<div style="font-size:small;font-family:tahoma,sans-serif"><i>   ~Mobile       <a \
href="tel:%2B94712112165" value="+94712112165" \
target="_blank">+94712112165</a></i></div><div \
style="font-size:small;font-family:tahoma,sans-serif">




<i>   ~Website     <a href="http://dulitha.me" target="_blank"><font \
color="#1155cc">dulitha</font>.me</a></i></div> <div \
style="font-family:arial;font-size:small"><i><span \
style="font-family:tahoma,sans-serif">   ~Twitter        </span><a \
href="https://twitter.com/dulitharw" \
style="color:rgb(17,85,204);font-family:tahoma,sans-serif" \
target="_blank">@dulitharw</a></i></div>





<div style="font-family:arial;font-size:small">    <i><span \
style="font-family:tahoma,sans-serif">~Github       <u><a \
href="https://github.com/dulichan" \
target="_blank">@dulichan</a></u></span></i></div><div \
style="font-family:arial;font-size:small">





    <i><span style="font-family:tahoma,sans-serif">~SO        </span><a \
href="http://stackoverflow.com/users/813471/chan" \
style="color:rgb(17,85,204);font-family:tahoma,sans-serif" \
target="_blank">@chan</a></i></div></div> </font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span \
class="HOEnZb"><font color="#888888">-- <br><div dir="ltr"><font face="georgia, \
serif">Regards,</font><div><font face="georgia, serif"><br></font><div> <font \
face="georgia, serif"><font><b><div><b><font>Darshana Gunawardana</font></b><br>


</div></b></font><span style="color:rgb(51,51,51)"><font>Software \
Engineer</font></span></font></div><div><font face="georgia, serif"><font \
size="1"><span style="color:rgb(51,51,51)">WSO2 Inc.;  <a href="http://wso2.com" \
target="_blank">http://wso2.com</a></span><i style="color:rgb(51,51,51)"><br>



E-mail: <a href="mailto:darshana@wso2.com" \
target="_blank">darshana@wso2.com</a><br></i></font><i \
style="color:rgb(51,51,51)"><font size="1">Mobile:  <a href="tel:%2B94718566859" \
value="+94718566859" target="_blank">+94718566859</a></font><br>


</i><span style="color:rgb(51,51,51)"><font size="1">Lean . Enterprise . \
Middleware</font></span></font><br> </div></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div \
style="font-size:small;font-family:tahoma,sans-serif"><div>Chan (Dulitha Wijewantha)  \
<br>Software Engineer - Mobile Development<br></div><div> WSO2Mobile  \
<br></div><div>Lean.Enterprise.Mobileware<br></div></div><div \
style="font-size:small;font-family:tahoma,sans-serif">  <i>  ~Email            <a \
href="mailto:dulitha@wso2mobile.com" style="color:rgb(17,85,204)" \
target="_blank">dulitha@wso2.com</a></i></div> <div \
style="font-size:small;font-family:tahoma,sans-serif"><i>   ~Mobile       \
+94712112165</i></div><div style="font-size:small;font-family:tahoma,sans-serif"><i>  \
~Website     <a href="http://dulitha.me" target="_blank"><font \
color="#1155cc">dulitha</font>.me</a></i></div> <div \
style="font-family:arial;font-size:small"><i><span \
style="font-family:tahoma,sans-serif">   ~Twitter        </span><a \
href="https://twitter.com/dulitharw" \
style="color:rgb(17,85,204);font-family:tahoma,sans-serif" \
target="_blank">@dulitharw</a></i></div> <div \
style="font-family:arial;font-size:small">    <i><span \
style="font-family:tahoma,sans-serif">~Github       <u><a \
href="https://github.com/dulichan" \
target="_blank">@dulichan</a></u></span></i></div><div \
style="font-family:arial;font-size:small">  <i><span \
style="font-family:tahoma,sans-serif">~SO        </span><a \
href="http://stackoverflow.com/users/813471/chan" \
style="color:rgb(17,85,204);font-family:tahoma,sans-serif" \
target="_blank">@chan</a></i></div></div> </div>



_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic