Need Help with Google API Interface-VBForums
Results 1 to 5 of 5

Thread: Need Help with Google API Interface

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    4

    Need Help with Google API Interface

    I am new to Visual Basic and this forum, so I hope I am posting in the right forum.

    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 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.

    redirect_uri=http://localhost/8080/

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

    Code follows:
    vb.net Code:
    1. Imports System.Net
    2. Imports System.Text
    3. Imports System.IO
    4. Public Class Form1
    5.  
    6.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    7.         Dim request As WebRequest
    8.  
    9.         '   Request authorisation from Google API
    10.         request = DirectCast(WebRequest.Create("https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&redirect_uri=http://localhost/8080/&client_id=nnnnnnnnnnn.apps.googleusercontent.com"), HttpWebRequest)
    11.      
    12.         Dim response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
    13.  
    14.         Dim stream As New StreamReader(response.GetResponseStream)
    15.         Dim shorturl As String = stream.ReadToEnd
    16.  
    17.         shorturl = stream.ReadToEnd
    18.  
    19.         MessageBox.Show(shorturl)
    20.     End Sub
    21. End Class
    Regards
    Quest2chill
    Last edited by quest2chill; Mar 15th, 2012 at 07:40 PM.

  2. #2
    New Member
    Join Date
    Mar 2012
    Posts
    1

    Re: Need Help with Google API Interface

    I have been messing with some of the Google API stuff at the moment also, I dont have the time to step into it before I goto work, but ill get into this thread later if you manage to find any info.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    4

    Re: Need Help with Google API Interface

    Hi MDOC,

    Still scratching my head, but not given up.

    Look forward to hooking up with you, two heads always better than one.

    Didn't realise that the Google API was such a dark art where VB.Net is concerned.

    Regards

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    4,245

    Re: Need Help with Google API Interface

    I a am not mistaken Google API has nothing to do with standard win API's
    The reason you are not getting answers is probably because you need to ask in either VB forum or ASP.NET forum.
    Slow as hell.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    4

    Thumbs up Re: Need Help with Google API Interface

    Thanks for the pointer sapator.... I'll give that a try.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.