Get Auto token

Topics: Developer Forum
Mar 3, 2011 at 11:37 AM

Hi,

I am trying to get the authentication token. Below is my code:

                Flickr flickr = new Flickr(ApiKey.Text, SharedSecret.Text);
                Auth auth = flickr.AuthGetToken(Frob);
                OutputTextbox.Text += "User Authenticated = " + auth.User.UserName + "\r\n";
                OutputTextbox.Text += "Auth Token = " + auth.Token + "\r\n";

                AuthToken.Text = auth.Token;

 

But application get stuck at retrieving auth (line 2). Please provide your inputs ASAP.

Thanks,

Tushar Ladole

Coordinator
Mar 3, 2011 at 11:45 AM

Have you authenticated the Frob? i.e. Have you sent the user to the Flickr web site to authenticate your application?

You need to do this each time you get a Frob via AuthGetFrob().

Sam

Mar 3, 2011 at 11:49 AM

No,

I have FlickrNet dll 3.0.0 and it was working fine previously.

Tushar

Coordinator
Mar 3, 2011 at 11:52 AM

I don't see how it could of if you aren't authenticating the user on the Flickr web site.

Without seeing more of your code, such as where you are getting the Frob from, and what error you are getting I can't really say any more.

Sam

Mar 3, 2011 at 12:46 PM
Edited Mar 3, 2011 at 12:49 PM

My apologies,

I create this test application to get auth token for my account previously. But now I created New account and I tried to get auth token using my application

I have button to get Frob and then I use this Frob to get Auth Token. Application stuck while retrieving Frob. It doesn't throw any error, just stuck at line 2. I wait for half an hour but no output.

Please find the implementation as below,

For getting Frob:

            Flickr flickr = new Flickr(ApiKey.Text, SharedSecret.Text);
            string Frob =flickr.AuthGetFrob();
            OutputTextbox.Text =  Frob ; //Added text to outbox textbox
            string url = flickr.AuthCalcUrl(Frob, AuthLevel.Write); // check if OK

For getting Auth Token:

            string Frob = OutputTextbox.Text;
            Flickr flickr = new Flickr(ApiKey.Text, SharedSecret.Text);

            Auth auth = flickr.AuthGetToken(Frob);
            string token = auth.Token; //use this token

 

Tushar

Coordinator
Mar 3, 2011 at 1:52 PM

Well it's working fine at this end I'm afraid.

What are you doing with the url? You need to redirect the user to this url, e.g. with System.Diagnostics.Process.Start(url) command.

Sam

Mar 3, 2011 at 1:59 PM

Ohh.... Thanks... :)

But is it necessary to redirect user to get Auth token? Can we store this auth token and reuse the same!!!

 

Tushar

Coordinator
Mar 3, 2011 at 2:02 PM

You need to redirect them to get the auth token, but once you have it you can store it and reuse it. The frob is temporary, and should not be reused.

Mar 3, 2011 at 2:08 PM

Thank you very much... you solved my problem..... :)