Flickr 'Invalid auth token (98)' Uploading videos from Asp.net Application
Asked Answered
Y

1

8

I am attempting to allow user to upload videos to Flickr from an Asp.net application using the FlickrNet library/API. I've obtained an API key and an API secret from Flickr. Additionally I am retrieving an authToken using the AuthGetFrob method from the FlickrNet library.

My Using Statements are as Follows

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlickrNet;

I have created two methods to accomplish this task.

One which gets and returns the AuthToken

private string GetAuthenticateToken()
{
    Flickr flickr = new Flickr(FLICKR_API_KEY, FLICKR_API_SECRET);

    string frob = flickr.AuthGetFrob();

    return flickr.AuthCalcUrl(frob, AuthLevel.Write);
}

And One the Uploads the File Using that AuthToken

public void UploadFile(string fileName, string title, string description)
{
    try
    {

        string authToken = GetAuthenticateToken();

        Flickr flickr = new Flickr(FLICKR_API_KEY, FLICKR_API_SECRET, authToken);


        string photoId = flickr.UploadPicture(fileName, title, description, "", true, false, false);
        }
    catch (Exception ex)
    {
        throw ex;
    }
}

However, when I make the call to 'UploadPicture' the following exception is thrown. 'Invalid auth token (98)'.

The contents of the AuthRequest Http request looks like this.

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
<frob>72157627073829842-9d8e31b9dcf41ea1-162888</frob>
</rsp>

And the content of the Upload methods Http request looks like this.

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
    <err code="98" msg="Invalid auth token" />
</rsp>

I saw a similar post on the flickr forums here but based on my understanding, it appears that I am doing everything right yet still cannot figure what I am doing wrong.

Any help would be greatly appreciated.

Yeomanry answered 29/6, 2011 at 4:30 Comment(0)
Y
5

Okay so I hate to answer my own questions, especially one that received no votes, no answers, and very few views, however none the less I was given the answer from support at Flickr so I figured I might as well post it here for in case someone else finds this of use.

AuthCalcUrl returns a URL, not the actual authentication token. Also that is more for desktop authentication, rather than web based authentication. The forum post you link to is talking about Mobile authentication. For web authentication you need to follow the flow detailed here: So you call Flickr.AuthCalcWebUrl, and then redirect the user to that URL. Then when they have authenticated they will get sent to the Callback URL set up in your API key settings. This URL will include a frob. Then finally in the callback url web page you get the frob from the querystring and call Flickr.AuthGetToken(frob); If you want to see this in action then download the example ASP.Net web site from the example page.

Yeomanry answered 29/7, 2011 at 2:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.