Smugmug web service ported to O2 : Host authentication required

Thanh Trung Dinh dinhthanhtrung1996 at
Tue Jun 5 23:15:32 BST 2018


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.

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.


On Sun, Jun 3, 2018 at 9:52 PM, Thanh Trung Dinh <
dinhthanhtrung1996 at> wrote:

> Hi Maik,
> In fact, I added those lines and nickName is not always empty. In
> core/tests/webservices/smugmug.cpp
> <>,
> 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 (reference here
> <>), 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.
> I attache here a patch with my latest modifications so that you can test
> it.
> Thanh.
> On Sun, Jun 3, 2018 at 8:13 PM, Maik Qualmann <metzpinguin at>
> wrote:
>> Hi Thanh,
>> Look smugwindow.cpp: 232 the nickName is always empty. Therefore your
>> login
>> function will never be executed. I think login with nickname does not
>> exist
>> anymore, so the dialog for entering email and password can be removed as
>> well.
>> The LINK to Smugmug then works through the website, but the return Json
>> code
>> has changed.
>> Maik
>> Am Samstag, 2. Juni 2018, 23:49:42 CEST schrieb Thanh Trung Dinh:
>> > Hi everyone,
>> >
>> > I'm porting digiKam web services with library O2, qt library for OAuth.
>> > Working on Smugmug, I'm stuck with an error that I didn't understand.
>> >
>> > Smugmug uses OAuth 1.0 as authentication method, like Flickr, so I used
>> same
>> > methods to login, get user data, post photos, etc. In fact, I can login
>> and
>> > get access token using O2 methods. I also verified that the token I got
>> is
>> > the right one. However, whenever I tried to use that token to get/post
>> > something, QNetworkReply returns with error 204
>> > (AuthenticationRequiredError) and error message : "Host authentication
>> > required". Besides, Smugmug has endpoints that don't require token to
>> access
>> > (e.g GET /api/v2/user/<nickname>). So when I tried normal GET method of
>> > QNetworkManager it worked, but when I used specific method for GET in O2
>> > (which prepares token and other necessary headers in the url request),
>> that
>> > error appeared,
>> >
>> > Did anyone see this message error when working with authentication
>> before? I
>> > really appreciate any help and guide, since I am really stuck here.
>> >
>> > Thanks,
>> >
>> > Thanh-Trung Dinh
>> >
>> >
>> >
>> > --
>> > Sent from:
>> html
> --
> Mr. Thanh-Trung Dinh
> Université de Technologie de Compiègne (UTC) - France
> Tel: +33 7 53 68 20 29

Mr. Thanh-Trung Dinh
Université de Technologie de Compiègne (UTC) - France
Tel: +33 7 53 68 20 29
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Digikam-devel mailing list