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

Posted by pat8719 on Stack Overflow See other posts from Stack Overflow or by pat8719
Published on 2011-06-29T04:30:21Z Indexed on 2011/06/30 16:22 UTC
Read the original article Hit count: 482

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET