正如前面的海報說,添加URL的選項卡設置,然後將選項卡添加到頁面。
當你的應用程序標籤加載後,你會得到一個不同的組值從一個普通的畫布頁。下面是一些粗糙的VB.NET代碼,你可以用它來梳理出來..
Public Class TabSignedRequest
Public user
'"user":{"country":"us","locale":"en_US","age":{"min":21}}
Public algorithm
'"algorithm":"HMAC-SHA256"
Public issued_at
'"issued_at":1302500880
Public user_id
'"user_id":"148.....47"
Public oauth_token
'"oauth_token":"1230................acUfvg"
Public expires
'"expires":1302505200
Public app_data
Public page As pageObject
'"page":{"id":"22.........40","liked":true,"admin":true}
Public profile_id
Public Shared Function getRequest(ByVal sr As String) As TabSignedRequest
sr = Replace(sr, "-", "+")
sr = Replace(sr, "_", "/")
Dim sig As String
Dim requestStr As String
Dim s = Split(sr, ".")
Try
sig = iTeam.Common.FromBase64(s(0))
Catch ex As Exception
End Try
requestStr = iTeam.Common.FromBase64(s(1))
Dim o = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(Of iTeam.Facebook.TabSignedRequest)(requestStr, New iTeam.Facebook.TabSignedRequest())
Return o
End Function
End Class
Public Shared Function FromBase64(ByVal base64 As String) As String
If base64 Is Nothing Then Throw New ArgumentNullException("base64")
Do Until isMult4(base64.Length)
base64 = base64 & "="
Loop
Dim b() As Byte
b = Convert.FromBase64String(base64)
Return System.Text.Encoding.UTF8.GetString(b)
End Function
Public Shared Function isMult4(ByVal n As Integer) As Boolean
Dim r As Integer
Math.DivRem(n, 4, r)
Return (r = 0)
End Function