<div dir="ltr"><div>Hi,</div><div><br></div><div>I finally figured out why I got this error. I post on forum so that if anyone working with O2 and smugmug api later won't waste too much time.</div><div><br></div><div> I found out that I had tried to create a request with some parameters, so I used O1::createRequestParameters to add those parameters to the request and sign it. However, I forgot to add the request to the url itself. According to a post I found on Smugmug forum, when a request cannot be parsed because of something relating to oauth, it will be returned with error "Authentication required", and that explains why I didn't get this error when trying to make a normal GET request (without any OAuth1 parameters) to a public endpoint. So, that's it - the root cause of this problem. <br></div><div><br></div><div>Thanh.<br></div><div><br></div><div><br></div><div><br></div><div><br> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 3, 2018 at 9:52 PM, Thanh Trung Dinh <span dir="ltr"><<a href="mailto:dinhthanhtrung1996@gmail.com" target="_blank">dinhthanhtrung1996@gmail.com</a>></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>Hi Maik,</div><div><br></div><div>In fact, I added those lines and nickName is not always empty. In <a href="https://cgit.kde.org/digikam.git/tree/core/tests/webservices/smugmug.cpp?h=gsoc18-exporttools-o2#n51" target="_blank">core/tests/webservices/<wbr>smugmug.cpp</a>, I added a command line option for login with nickname. When you run standalone test for smugmug with --login <nickname>, the nickname will be propagated when the login page is opened, so that I can get the nickName from user. In fact, It came from my misunderstanding. At that time, I had succeeded with authentication, but when I tried to get current user info from endpoint /api/v2!authuser (<a href="https://api.smugmug.com/api/v2/doc/reference/user.html" target="_blank">reference here</a>), I got the same error of "authentication required" that I mentioned above. I had misunderstood that there was problem with that endpoint, so in order to use other APIs, I had to have nickname (at least), so I added that command line option. However, later I found out that even with nickname, I still got the same error when I tried to POST something via APIs. I finally figured out that these endpoints (those I succeeded with GET) are public, so no need for access token, and the problem still remains with endpoints needing token (/api/v2!authuser is one of them). Therefore, it must be problem with including auth token to the request.</div><div><br></div><div>I attache here a patch with my latest modifications so that you can test it. <br></div><div><br></div><div>Thanh.<br></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Sun, Jun 3, 2018 at 8:13 PM, Maik Qualmann <span dir="ltr"><<a href="mailto:metzpinguin@gmail.com" target="_blank">metzpinguin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Thanh,<br>
<br>
Look smugwindow.cpp: 232 the nickName is always empty. Therefore your login <br>
function will never be executed. I think login with nickname does not exist <br>
anymore, so the dialog for entering email and password can be removed as well. <br>
The LINK to Smugmug then works through the website, but the return Json code <br>
has changed.<br>
<span class="m_8676409631472105823HOEnZb"><font color="#888888"><br>
Maik<br>
</font></span><div class="m_8676409631472105823HOEnZb"><div class="m_8676409631472105823h5"><br>
Am Samstag, 2. Juni 2018, 23:49:42 CEST schrieb Thanh Trung Dinh:<br>
> Hi everyone,<br>
> <br>
> I'm porting digiKam web services with library O2, qt library for OAuth.<br>
> Working on Smugmug, I'm stuck with an error that I didn't understand.<br>
> <br>
> Smugmug uses OAuth 1.0 as authentication method, like Flickr, so I used same<br>
> methods to login, get user data, post photos, etc. In fact, I can login and<br>
> get access token using O2 methods. I also verified that the token I got is<br>
> the right one. However, whenever I tried to use that token to get/post<br>
> something, QNetworkReply returns with error 204<br>
> (AuthenticationRequiredError) and error message : "Host authentication<br>
> required". Besides, Smugmug has endpoints that don't require token to access<br>
> (e.g GET /api/v2/user/<nickname>). So when I tried normal GET method of<br>
> QNetworkManager it worked, but when I used specific method for GET in O2<br>
> (which prepares token and other necessary headers in the url request), that<br>
> error appeared,<br>
> <br>
> Did anyone see this message error when working with authentication before? I<br>
> really appreciate any help and guide, since I am really stuck here.<br>
> <br>
> Thanks,<br>
> <br>
> Thanh-Trung Dinh<br>
> <br>
> <br>
> <br>
> --<br>
> Sent from: <a href="http://digikam.1695700.n4.nabble.com/digikam-devel-f1695701.html" rel="noreferrer" target="_blank">http://digikam.1695700.n4.nabb<wbr>le.com/digikam-devel-f1695701.<wbr>html</a><br>
<br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br><div class="m_8676409631472105823gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font size="2" face="comic sans ms, sans-serif">Mr. Thanh-Trung Dinh</font></div></div></div></div></div></div></div></div></div></div></div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><font size="2" face="comic sans ms, sans-serif">Université de Technologie de Compiègne (UTC) - France<br><font color="#000000">Tel:</font><font color="#3d85c6"> </font><font color="#000000">+33 7 53 68 20 29</font></font></div></div></div></div></div></div></div></div></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font size="2" face="comic sans ms, sans-serif">Mr. Thanh-Trung Dinh</font></div></div></div></div></div></div></div></div></div></div></div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><font size="2" face="comic sans ms, sans-serif">Université de Technologie de Compiègne (UTC) - France<br><font color="#000000">Tel:</font><font color="#3d85c6"> </font><font color="#000000">+33 7 53 68 20 29</font></font></div></div></div></div></div></div></div></div></div></div></div>
</div>