NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Imports System.Text.RegularExpressions
Imports Newtonsoft.Json.Linq

Partial Public Class multiFaceLogin
Inherits PhoneApplicationPage
Public scope As String = "email"
Public appid As String = "103622549058"
Public secret As String = "829f075878425895ecbe7184348b15a2"
Public kod As String
Public exchangeToken As String

Public accessToken As String
Public Sub New()
InitializeComponent()
End Sub

Private Sub PhoneApplicationPage_Loaded(sender As Object, e As RoutedEventArgs)
'Dim url As String = "https://m.facebook.com/dialog/oauth?locale=tr_TR&client_id=" + appid + "&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=" & scope & "&display=touch"

Dim url As String = "https://graph.facebook.com/oauth/authorize?client_id=103622549058&redirect_uri=http%3A%2F%2Fsocial.flashokey.com%2Foyunpark_okey%2Fstepwp.php&scope=public_profile"



ProgressBar1.Visibility = System.Windows.Visibility.Collapsed
WebBrowser1.IsScriptEnabled = True

WebBrowser1.Navigate(New Uri(url))
End Sub

Public Function readAccessToken(data As String) As String
Dim arr() As String
Dim aqu() As String
Try
arr = Regex.Split(data, "access_token=")

aqu = Regex.Split(arr(1), "&")
Return aqu(0)
Catch ex As Exception
MessageBox.Show("readAccessToken ERROR Data:" & data & " E:" & ex.ToString)

End Try
Return ""


End Function

Public Sub getAccessToken()
Dim webCli As New WebClient
AddHandler webCli.DownloadStringCompleted, AddressOf onDownloadString
Dim urx As String = "https://graph.facebook.com/oauth/access_token?client_id=" & appid & "&client_secret=" & secret & "&grant_type=fb_exchange_token&fb_exchange_token=" & accessToken

webCli.DownloadStringAsync(New Uri(urx))


End Sub
Public Sub onDownloadString(S As Object, e As DownloadStringCompletedEventArgs)
trace("On result:" & e.Result)
If e.Result.IndexOf("access_token=") <> -1 Then
exchangeToken = readAccessToken(e.Result)
trace("Token:" & exchangeToken)
'postToWall(readAccessToken(e.Result), "Bu bir deneme1 ")
getMyInfo()
End If




End Sub
Public Sub postToWall(token As String, msg As String)
Dim webcli As New WebClient
webcli.UploadStringAsync(New Uri("https://graph.facebook.com/me/feed"), "POST", "message=" + HttpUtility.UrlEncode(msg) + "&access_token=" & token)
End Sub

Public Sub getMyInfo()
Dim webcli As New WebClient
AddHandler webcli.DownloadStringCompleted, AddressOf onDownloadComplete
webcli.DownloadStringAsync(New Uri("http://oyunpark.com/winphone/faceloginhandler.php?devid=" & deviceId() & "&port=" & connectPort & "&access_token=" & exchangeToken))
ProgressBar1.Value = 90


End Sub
Public Function getCountry(str As String)
If str.IndexOf("_") <> -1 Then
Dim arr() As String
arr = Regex.Split(str, "_")
Return arr(1)

End If
Return str

End Function
Public Function getCins(cins As String) As String
If cins = "male" Then
Return 0
End If
Return 1

End Function
Public Sub onDownloadComplete(e As Object, sends As DownloadStringCompletedEventArgs)
Try
Dim TjO As JObject = JObject.Parse(sends.Result)
Dim suc As Boolean = CBool(TjO("success").ToString)

Dim tMsg As String = TjO("msgbox").ToString

If tMsg <> "" And tMsg <> "NULL" Then
If tMsg.Length >= 5 Then
MessageBox.Show(tMsg)

End If
End If

If suc <> True Then


Exit Sub

End If

faceHash = TjO("hash").ToString

faceInfo = TjO
faceId = TjO("id").ToString
faceAd = TjO("first_name").ToString
faceSoyad = TjO("last_name").ToString
faceAvatar = TjO("avatar").ToString
faceUlke = getCountry(TjO("locale").ToString)
faceCins = getCins(TjO("gender").ToString)
'faceEmail = TjO("email").ToString

trace("İsim:" & TjO("name").ToString)
Catch ex As Exception
trace("HATAA:" & ex.ToString)

MessageBox.Show("Profil bilgileriniz okunamadı")

End Try
isFaceMember = True
ProgressBar1.Value = 100
autoLoginFace = True
NavigationService.Navigate(New Uri("/MainPage.xaml", UriKind.Relative))


trace("Info:" & sends.Result)
End Sub
Public Sub onUriComplete(url As String)


trace("on:" & url)
Exit Sub

If url.StartsWith("https://m.facebook.com/dialog/oauth/write") = True Or url.StartsWith("http://m.facebook.com/dialog/oauth/write") = True Then
Dim urx As String = "https://m.facebook.com/dialog/oauth?client_id=" + appid + "&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=" & scope & "&display=touch"

WebBrowser1.IsScriptEnabled = True

WebBrowser1.Navigate(New Uri(urx))
Exit Sub
End If

trace("content:" & WebBrowser1.SaveToString())
Dim ax() As String
If url.StartsWith("https://graph.facebook.com/oauth/access_token") = True Or url.StartsWith("http://graph.facebook.com/oauth/access_token") = True Then
Dim token As String = readAccessToken(WebBrowser1.SaveToString())
accessToken = token

' Dim exchangeUrl As String = "https://graph.facebook.com/oauth/access_token?client_id=" & appid & "&client_secret=" & secret & "&grant_type=fb_exchange_token&fb_exchange_token=" & token
' WebBrowser1.Navigate(New Uri(exchangeUrl))
getAccessToken()
ProgressBar1.Value = 60

Exit Sub

End If

If url.StartsWith("http://www.facebook.com/connect/login_success.html") = True Or url.StartsWith("https://www.facebook.com/connect/login_success.html") = True Then
ax = Regex.Split(url, "code=")
kod = ax(1)
If kod.EndsWith("#_=_") = True Then
kod = kod.Substring(0, kod.Length - 4)
trace("Oauth go...")
WebBrowser1.Visibility = System.Windows.Visibility.Collapsed
ProgressBar1.Visibility = System.Windows.Visibility.Visible

ProgressBar1.Value = 30


WebBrowser1.Navigate(New Uri("https://graph.facebook.com/oauth/access_token?client_id=" & appid & "&code=" & kod & "&redirect_uri=https://www.facebook.com/connect/login_success.html&client_secret=" & secret))
End If
trace("Login kod:" & kod)
End If

End Sub


Private Sub WebBrowser1_Navigated(sender As Object, e As NavigationEventArgs) Handles WebBrowser1.Navigated
If e.Uri.IsAbsoluteUri = True Then
onUriComplete(e.Uri.ToString)

End If
End Sub
Public Sub taskClear()
Dim at As New Action(AddressOf clr)
Deployment.Current.Dispatcher.BeginInvoke(At)

End Sub
Public Async Sub clr()

Await New WebBrowser().ClearCookiesAsync()
Await New WebBrowser().ClearInternetCacheAsync()

End Sub



Private Sub Button1_Click(sender As Object, e As RoutedEventArgs) Handles Button1.Click
taskClear()
autoLoginFace = False
isFaceMember = False

NavigationService.Navigate(New Uri("/MainPage.xaml", UriKind.Relative))
End Sub

Private Sub WebBrowser1_ScriptNotify(sender As Object, e As NotifyEventArgs) Handles WebBrowser1.ScriptNotify
Dim tData As String = e.Value.ToString

'ajax req
If tData.StartsWith("onFacebookInfo,,") = True Then
Dim infos As String = tData.Replace("onFacebookInfo,,", "")


Dim tInfo As JObject = JObject.Parse(infos)

tInfo("last_name") = getFirstStr(tInfo("last_name").ToString)
tInfo("first_name") = getFirstName(tInfo("first_name").ToString)


trace("return LastName:" & tInfo("last_name").ToString)


faceInfo = tInfo

faceId = tInfo("id").ToString
faceAd = tInfo("first_name").ToString

faceSoyad = getFirstStr(tInfo("last_name").ToString)



faceAvatar = "https://graph.facebook.com/" & faceId & "/picture"

faceUlke = tInfo("locale").ToString


faceCins = getCins(tInfo("gender").ToString)
End If

If tData.StartsWith("onFacebookHash,,") = True Then
faceHash = tData.Replace("onFacebookHash,,", "")



isFaceMember = True
ProgressBar1.Value = 100
autoLoginFace = True
NavigationService.Navigate(New Uri("/MainPage.xaml", UriKind.Relative))


End If


End Sub
Public Function getFirstStr(nm As String) As String
If nm.Length >= 1 Then
Return nm.Substring(0, 1).ToUpper


End If
Return nm.ToUpper()


End Function

Public Function getFirstName(nm As String) As String
Dim arrs() As String

If InStr(nm, " ") >= 1 Then
arrs = Split(nm, " ")
Return arrs(0)

End If
Return nm



End Function

End Class


     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.