08-11-19, 10:26 PM
لدي هذا الكود اين المكان المناسب له وظيفه هذا الكود هو لجلب الاكسيس توكن الخاص بالفيس بوك بعد تسجيل الدخول من خلال 2 تكست بوكس و زر بوتن
كود :
Private Function GetToken(ByVal User As String, ByVal pass As String) As String
Dim result As String
Try
Dim str As String = "https://api.facebook.com/restserver.php"
Dim str2 As String = "62f8ce9f74b12f84c123cc23437a4a32"
Dim dictionary As Dictionary(Of String, String) = New Dictionary(Of String, String)()
dictionary.Add("api_key", "882a8490361da98702bf97a021ddc14d")
dictionary.Add("credentials_type", "password")
dictionary.Add("email", User)
dictionary.Add("format", "JSON")
dictionary.Add("generate_machine_id", "1")
dictionary.Add("generate_session_cookies", "1")
dictionary.Add("locale", "en_CA")
dictionary.Add("method", "auth.login")
dictionary.Add("password", pass)
dictionary.Add("return_ssl_resources", "0")
dictionary.Add("v", "1.0")
Dim text As String = String.Empty
For Each keyValuePair As KeyValuePair(Of String, String) In dictionary
text = text & keyValuePair.Key & "=" + keyValuePair.Value
Next
text += str2
text = Form1.PHPMd5Hash(text).ToLower()
dictionary.Add("sig", text)
Dim url As String = str & "?" & QueryStringBuilder.BuildQueryString(dictionary, "&")
result = CStr(JObject.Parse(Me.[GET](url))("access_token"))
Catch
result = Nothing
End Try
Return result
End Function