Google API v3 OAuth2服务帐户令牌网址404错误

时间:2015-04-20 18:20:34

标签: google-analytics-api google-oauth2

我在尝试发布此网址时收到404错误:

https://www.googleapis.com/oauth2/v3/token

在Google Oauth文档中引用:

https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatingjwt

以下是一段代码,以防它有用:

Dim tokenRequestURL As String = "https://www.googleapis.com/oauth2/v3/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9." & GetJWTclaimSet() & "." & GetJWTsignature()

Dim client As New WebClient()
Dim json = client.DownloadString(tokenRequestURL)

从评论中复制的更新:

    Dim tokenRequestURL As String "https://www.googleapis.com/oauth2/v3/token" 
Dim client As New WebClient() 
Dim params As New Specialized.NameValueCollection 
params.Add("grant_type", "urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer") 
params.Add("assertion", "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9." & GetJWTclaimSet() & "." & GetJWTsignature()) 
Dim responsebytes = client.UploadValues(tokenRequestURL, "POST", params)

0 个答案:

没有答案