Invalid Frob (108) - no idea why

Topics: Developer Forum
Nov 14, 2009 at 12:39 AM

Very simple asp.net page here which puts up a login url (this is an attempt to create a desktop token via an ASP.Net page to make life easier, but using AuthCalcWebUrl has the same result):

 

	protected override void OnInit(EventArgs e)
	{
		base.OnInit(e);
		Flickr flickr = new Flickr();
		flickr.ApiKey = "<<key>>";
		flickr.ApiSecret = "<<secret>>";

		if (Request.QueryString["frob"] != null)
		{
			Auth auth = flickr.AuthGetToken(Request.QueryString["frob"]);
			string url = Request.Url.OriginalString;
			url = url.Substring(0, url.IndexOf('?'));
			Response.Write(url + "token=" + auth.Token + "&uid=" + auth.User.UserId);
		}
		else if (Request.QueryString["token"] == null)
		{
			string frob = flickr.AuthGetFrob();
			string url = flickr.AuthCalcUrl(frob, AuthLevel.Read);

			Response.Write("<a href=\"" + url + "\" target=\"_blank\">Go here</a>");
			Response.Write("<br/>");
			Response.Write("<a href=\"" + Request.Url.OriginalString + "?frob=" + frob + "\">then here.</a>");
			return;
		}
		else
		{
			flickr.ApiToken = Request.QueryString["token"];
			Photos photos = flickr.PhotosSearch(Request.QueryString["uid"], "", TagMode.None, null,
													DateTime.MinValue, DateTime.MinValue, 0,
													20, 0, PhotoSearchExtras.All);
		}
	}

I get "Invalid Frob (108)" on the AuthGetToken line no matter what I do.  Surely I'm missing something obvious?

Coordinator
Nov 14, 2009 at 1:17 PM

Not sure what might be happening here - but you appear to be using desktop authentication to authenticate a web application - I'd recommend doing web authentication instead. If you got two people calling the above page at once you would no doubt get the invalid frob error.