Authentication should be done automatically by the application


#1

Hey guys! I just want to ask help about TwitterVB http://twittervb.codeplex.com/ . It’s a DLL file added as a reference in a Visual Basic application. I’m using it to create a Twitter Application in Microsoft Visual Basic 2010 Express Edition. I’m almost finished with my goal. The application has a GET CODE button wherein when you clicked it, it will redirect the user to the default web browser and the user will click the Authorize App Button in the site and when you do that a PIN will be shown and you will copy the PIN and you put the PIN in the VB application and when you click enter, the information about your Twitter account will be shown in the application. I am already finished with all of that. My problem is that… is there a way wherein the application dont need to open a default browser. Rather, it will just open a webbrowser in the application itself. Something like a mini browser in the application. And is there a way wherein the application will be the only one to read the PIN. It will like automatically read the PIN. The user dont need to view the PIN. It’s like when the user click the Authorize App Button, it will automatically authorize the application to view necessary info about the user’s account.

Private Sub GetTheCode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetCode.Click
Try
Dim url As String = twitter.GetAuthorizationLink(consumerkey, consumerkeysecret)
Process.Start(url)
Catch ex As Exception
End Try
End Sub

I think I need to edit the Process.Start(url) since that line is for opening the default browser.
What should I do to disable opening the default browser but rather open a mini browser in the application itself.
What should I do for the authentication to be done automatically by the application?


#2

It’d be against policy to “scrape” the PIN by reading it from the returned HTML on the page that displays the OAuth verifier.

I don’t know much about developing with MS Visual Basic in this way, but if it has access to some kind of embedded web view you could make use of that in some way theoretically. Even better would be if your application can register a URI scheme on the system. You’d then set your dev.twitter.com/apps record to have a default callback like “http://somewhere.com” and set a dynamic oauth_callback on the request_token step pointing to your application like mpacao://twitter_callback – this way when you send the user to the web browser and they complete the flow, this callback will be executed and the user returns to your app automatically – you then receive the oauth_verifier in the callback itself.


#3

this is very annoying… why twitter don’t include pin in the url??? pff…


#4

The oauth_verifier is included in the URL of course when you receive an executed OAuth callback while using OAuth in the prescribed manner.


#5

this is for web application or desktop application or both? Because I am creating a desktop application. :slight_smile:


#6

If you’re creating a desktop application, you might want to use xAuth instead of out-of-band OAuth with the PIN code flow. Alternately, you could setup a custom URI scheme in the operating system and using the web-based redirect OAuth flow. If you did choose to go with the out-of-band PIN-based flow, automating the consumption of the PIN is not allowed, whether for a desktop or a web application.


#7

That’s what I’m looking for! But can you give me the source code or something like that , because i don’t know how to write it.
Thanks in advance.


#8

(i from brazil. then translater for portuguese-brazil) querida por favor tente colocar o “throw ex” de baixo do “Catch ex As Exception”


#9

How to get oauth_token? please help me! Thanks!

twttr.anywhere(function (T) {
T("#login").connectButton({
authComplete: function(user,bridge_code) {
// triggered when auth completed successfully
console.log(bridge_code);
},
signOut: function() {
// triggered when user logs out
console.log(‘da logout’);
}
});
});


#10

I’d simply like to know how you got twitter vb2 to work with visual basic 2010.
It doesnt work for me and causes all kinds of problems no matter what framework i switch to


#11

i used a similar code to authenticate. But no browser opens. Here the code is.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

     Try
          Dim url As String = tw.GetAuthorizationLink(consumer, consumersecret)
         Process.Start(url)
    Catch ex As Exception

    End Try

End Sub

PLEASE HELP ME. SOMEONE TELL ME WHAT SHOULD I DO.