I'm using Google OAuth and trying to implement this to my web application by got error 400. I'm following given example from their documentation.
I suspect that problem is about getting authorization code on callback. Any ideas?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim p As New OAuth2Parameters
Dim code, clientid, secret, scope, redirecturi, authurl As String
code = Request.QueryString("code")
If code Is Nothing Then
clientid = "clientid"
secret = "secret"
scope = "https://docs.google.com/feeds/ https://docs.googleusercontent.com/ https://spreadsheets.google.com/feeds/"
redirecturi = "http://someuri/tools/default.aspx"
p.ClientId = clientid
p.ClientSecret = secret
p.RedirectUri = redirecturi
p.Scope = scope
authurl = OAuthUtil.CreateOAuth2AuthorizationUrl(p)
info.InnerHtml = "Follow this <a href='" & authurl & "'>link</a>"
Else
code = Request.QueryString("code")
info.InnerHtml = Nothing
p.AccessCode = code
OAuthUtil.GetAccessToken(p)
Dim accessToken As String = p.AccessToken
info.InnerText = accessToken
Response.Write(code)
End If
End Sub
If you're following this example from the link you provided, then you are using the depreciated Google Document Lists API. You might try using the new Google Drives API instead.
Mamboking
Member
183 Points
125 Posts
Have problem with Google Oauth
Nov 28, 2012 09:04 AM|LINK
I'm using Google OAuth and trying to implement this to my web application by got error 400. I'm following given example from their documentation. I suspect that problem is about getting authorization code on callback. Any ideas?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim p As New OAuth2Parameters Dim code, clientid, secret, scope, redirecturi, authurl As String code = Request.QueryString("code") If code Is Nothing Then clientid = "clientid" secret = "secret" scope = "https://docs.google.com/feeds/ https://docs.googleusercontent.com/ https://spreadsheets.google.com/feeds/" redirecturi = "http://someuri/tools/default.aspx" p.ClientId = clientid p.ClientSecret = secret p.RedirectUri = redirecturi p.Scope = scope authurl = OAuthUtil.CreateOAuth2AuthorizationUrl(p) info.InnerHtml = "Follow this <a href='" & authurl & "'>link</a>" Else code = Request.QueryString("code") info.InnerHtml = Nothing p.AccessCode = code OAuthUtil.GetAccessToken(p) Dim accessToken As String = p.AccessToken info.InnerText = accessToken Response.Write(code) End If End SubCareed
All-Star
18764 Points
3637 Posts
Re: Have problem with Google Oauth
Nov 28, 2012 12:50 PM|LINK
If you're following this example from the link you provided, then you are using the depreciated Google Document Lists API. You might try using the new Google Drives API instead.
https://developers.google.com/drive/quickstart-cs?hl=ru
"The oxen are slow, but the earth is patient."