Ok. Where I'm at so far. I have a
VB.NET application that is trying to create calendar events without having to keep reauthorising.
I've added a form with a Web browser control. This handles the initial authorisation;
Dim s As String
s = s & "&response_type=code"
s = s & "&redirect_uri=urn:ietf:wg:oauth:2.0:oob"
s = s & "&client_id=your client id"
s = s & "&access_type=offline"
WebBrowser1.Navigate(New Uri(s).ToString)
I then use the DocumentTitleChanged event of the browser control to get the Authorisation code from the page title. With the Authorisation code I can get the access and refresh tokens;
Dim s As String
s = "code=" & lblAuthCode.Text
s = s & "&client_id=your client id"
s = s & "&client_secret=your client secret"
s = s & "&redirect_uri=urn:ietf:wg:oauth:2.0:oob"
s = s & "&grant_type=authorization_code"
Dim oWeb As New System.Net.WebClient()
oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes(s)
Dim AuthResponse As String = System.Text.Encoding.ASCII.GetString(bytRetData)
From the AuthResponse I can get the access token and the refresh token.
With the access token I can do http GETs to retrieve calendar events etc but I would still like to use the API for creating and modifying calendar events but that seems to require some sort of authenticator which is where I'm stuck. I have the keys I just need to be able to use them to create an authenticator.