Getting no results (Failed to complete the authentication process)

Oct 25, 2008 at 4:53 PM
It seems there is little in the way of documentation for this and I'm afraid I found it somewhat difficult to get started.

I tried the following:
http://pastebin.com/m2b7c57f2

The problem I was getting was an error of "Failed to complete the authentication process".

I found that I had to add the following code in before my query to get things to work:
            context.Authenticate();
            if (!context.IsAuthenticated()) return;

Hopefully I'm now on the right track and maybe this will help someone else.


Coordinator
Oct 26, 2008 at 1:48 AM
Edited Oct 26, 2008 at 1:53 AM
Ok generally this only be required if there is a failed authentication scenario. I wonder why that could be useful if authentication is not  done properly , Let me know :-) So that i can update the project likewise.

Generally, authentication is done automatically so that you dont need to do that.
Oct 26, 2008 at 4:55 AM
OK I'm not sure what's happening.  The IE window was popping up every time even though it just kept coming up saying it was authenticated and I could close the window.

This stopped happening and now things work fine even if I remove those two lines.

If I somehow manage to reproduce things I'll try to debug it further.  For now things seem to be working.

Thanks for a very handy library!
Oct 26, 2008 at 7:11 AM
Edited Oct 26, 2008 at 7:22 AM
I finished writing my application and then tried to run the Release version.  I'm getting the same problem again!  :(

That is:
  • IE opens up and displays a window with "You have successfully authorized the application FlickrDeDupr."
  • An error is returned of "Failed to complete the authentication process"
The final release executable running outside Visual Studio is even worse.  It's crashing with an error parsing my WindowMain.xaml.
If I drill down I see the authentication error then "Error code: 108 Message: Invalid frob".

I thought it might be related to running on Vista with UAC so I tried running the exe as Administrator.  For som reason the launched IE window then hangs on "Connecting".

When it does manage to work (in the Visual Studio environment) if I then copy the token it creates to the cache folder things work just fine.

It's almost as if most of the time the call to do the authentication is returning too early (the error comes up even before the IE window is closed).  Once it works once and the cache is there it's fine.  Should this call block?  If so perhaps the timeout is too low.  I'm grab your source code and see if I can make any sense of it.  :)

Perhaps this is my inexperience with WPF/Vista and nothing to do with your library.  I'll keep trying to figure it out I guess.
Coordinator
Oct 26, 2008 at 11:56 AM
There was similar problem, and i guess i fixed that and put a patch on the release section.

Can you paste me here the dll.
Oct 27, 2008 at 4:31 PM
Edited Oct 28, 2008 at 3:23 AM
I'm using the latest version (updated Oct 17th).  I've downloaded the source code and whilst I was able to reproduce the bug the other day I didn't get a chance to track it down.  Unfortunately I'm now unable to reproduce it.  I did make some minor changes to the code so I'll back up what I have and try again with the original code.  I'll let you know how I go but perhaps it was actually some sort of issue with the Flickr API itself generating an invalid frob (whatever that is).

I did some reading (http://www.flickr.com/services/api/auth.howto.desktop.html) and followed through your code.  I can confirm the bug is that in BaseRepository.cs in the method InitializeToken the method is returning before the user has completed the request in the browser.  Then when GetElement is called in CreateDesktopToken it is doing so before the application has been authorized with that frob, hence the "Error code: 108 Message: Invalid frob" being thrown.

Since p.WaitForExit does not seem to be reliable the only solution I've found is the following:
                    bool result = p.WaitForExit(int.MaxValue);
                    if (result)
                    {
                        p.WaitForExit();
                    }
                    MessageBox.Show("Please click OK when you've allowed the application access in Flickr",
                                    "Flick Authorization");

I guess you could remove the WaitForExit code entirely but perhaps it works under things other than Vista so I thought I'd leave it there.

Coordinator
Oct 28, 2008 at 7:42 PM
Basically , wait for exit should not act like that. I am using Windows Vista.
Jan 15, 2009 at 3:23 AM
I am pleased to say that after a long break from this I decided to spend some more time getting this working so I could make my code available online.

This time around I quickly found the problem.  IE 7 "protected mode" in Vista.  Basically you need to add the following sites to your Trusted Sites zone:
http://*.flickr.com/
https://login.yahoo.com/

Then everything works as you'd expect!  :)

I'll grab your latest release and include that now.

Thanks again for a great library.

Coordinator
Jan 16, 2009 at 7:29 AM
I will add this note in the readme.txt thanks for the contribution.