Application Name not working

Oct 12, 2009 at 7:07 AM
Edited Oct 14, 2009 at 3:24 PM

Hey all,

I'm using the VB demo, and i'm trying to test the application name to display when using the username/password authentication. 

It pops up as 'API' not '<MyAppName>'  I do have my secret and my key for it in the app.config tho.  Maybe i'm missing something.

Which part of the TwitterContext would i assign my keys to? 

Thanks

 

**Edit 10/14/2009**

So, i've spent some time going thru the actual code of the linqtotwitter, and I see that there are processes in each of the different linqtotwitter classes that handle these, such as gettoken for the desktopauthorization, etc.  I'm guessing one of these kinda things need to be built for the usernamepasswordauthorization class for it to handle this.  Easy Enough I guess to dig thru. 

I just want to make sure i'm not screwing up the implementation type, forinstance, if i should have desktopauthorization, and using usernamepasswordauthentication to complement it.

~Doc

Oct 14, 2009 at 3:25 PM

hrm.. looks like edits don't show up.

Oct 15, 2009 at 3:00 PM

You don't need a consumer key and secret when you're using username+password authentication.  

When you say "it pops up" showing API instead of your app name, are you referring to the username+password dialog?

Oct 15, 2009 at 10:25 PM

I'm sorry,

let me rephrase.   (Btw, my goal is to have it show the name of the application, not the phrase 'API')
The client name when i send something thru seesmic, etc, displays as:

12:59 PM Oct 14th from Seesmic


However on a tweet that generates from my application displays as:

1:21 AM Oct 12th from API


Thats using usernamepasswordauthentication.

If i use the other authentication (Desktop I think), it displays as:

1:23 AM Oct 12th from KritterDeck

 

Coordinator
Oct 15, 2009 at 11:37 PM

Hi docnasty,

I understand now.  If you were using username/password authentication, that value would be set in the UserAgent property of the TwitterContext instance.  However, with OAuth, that value is set via the application settings at Twitter.  To change it, visit your application page at Twitter (http://twitter.com/apps), click on the link for your application, click on the Edit Application Settings button, and change Application Name from API to KritterDeck.

BTW, let me know if you want me to link to your app when you get it published.

Joe

Oct 16, 2009 at 3:30 PM

Hi Joe,

Thanks for your quick reply.   I have Kritter and KritterDeck both listed correctly under the twitter apps. 

A question regarding 'useragent' would i bundle that with the UsernamePasswordAuthorization  

Dim auth As UsernamePasswordAuthorization = New UsernamePasswordAuthorization 
        auth.UserName = "xxxx"
        auth.Password = "xxxx"
        auth.UserAgent = "Kritter"

which would eventually make it's way into the twitterContext:
twitterCtx = New TwitterContext(auth, "https://twitter.com/", "http://search.twitter.com/")

Or would i attach it to the twitterCtx after the creation
twitterCtx.UserAgent = "Kritter"

Thanks for your continued insight.

~Doc

Coordinator
Oct 16, 2009 at 5:16 PM

Doc,

Right now, setting UserAgent via auth doesn't change anything because it's overwritten with "LINQ to Twitter v1.0", which you might have seen already.  TwitterContext.UserAgent will produce "Kritter;LINQ to Twitter v1.0".

Thoughts on what the best implementation would be?

Joe

Oct 16, 2009 at 6:45 PM

Well, the "LINQ to Twitter v1.0" is currently sitting in the TwitterExecute.cs class of the linqtowtitter.dll. 

There are 2 versions of it, one that is called from the function twitterExecute() and twitterExecute(iTwitterAuthorization).

If we look at the first one that is meant for the usernamePasswordAuthorization, it looks like this:

public TwitterExecute()
        {
            this.AuthorizedClient = new UsernamePasswordAuthorization();
            this.AuthorizedClient.UserAgent = "LINQ To Twitter v1.0";
        }

So, I would assume that the UserAgent is part of the "Auth" section of my first example.  My actual concern is that this would open up to less than honest twitter users to be able to 'spoof' clients, as its not actually an authentic client. 

The actual goal would be to utilize the ITwitterAuthorization to allow the use of UsernamePasswordAuthentication.

I'm going to have to read thru the API and what needs to be sent to twitter, and maybe read up on this part of the api a bit more.

The authentication in my opinion, would have to be split tho,

step 1 would be to always authenticate the client first, cache the authentication key
step 2. would be to then pass the username/password next.  

This would allow for user blocking and client blocking incase someone abused their application, or for identifying 'firehose' clients or corporate users who paid for firehose access.

So... I need to do some reading up and see how you manage the tokens in DesktopOAuth, and see how the twitter api processes the tokens when you pass thru information.  Watch for a follow up this weekend. 

I think a good place for me to start tho will be to look into the UsernamePasswordAuthentication class and dig into the 'InitializeRequest' and compare how that processes:  request.UserAgent = this.UserAgent;    and then compare it to the 'GetVerifier' function of DesktopOAuth, and really see how the whole system works.