Help Needed in Acquiring Authorisation From The Google API


Mar 3, 2012
Programming Experience
I am writing an application which will run on the windows desktop and will make various use of internet connections.

My main problem at present is acquiring authorisation from the Google API.
This apparently has to be achieved via several steps in order to acquire access to a users information.

My code (below), requests authorisation, and as I am not using a webbrowser the authorisation response has to be returned via a localhost port.
(This is Google's preferred method apparently)

My request seems to be accepted as the server is not rejecting it, however I now need to understand how to listen out on the localhost port so that I may receive the authorisation request response.


Could anyone please advise me on how this may be achieved?

Code follows: Code:

  1. Imports System.Net
  2. Imports System.Text
  3. Imports System.IO
  4. Public Class Form1
  5. Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  6. Dim request As WebRequest
  7. ' Request authorisation from Google API
  8. request = DirectCast(WebRequest.Create(""), HttpWebRequest)
  9. Dim response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
  10. Dim stream As New StreamReader(response.GetResponseStream)
  11. Dim shorturl As String = stream.ReadToEnd
  12. shorturl = stream.ReadToEnd
  13. MessageBox.Show(shorturl)
  14. End Sub
  15. End Class

Top Bottom