Add Newtonsoft.Json.dll file as resource
---------------------------------------------
in "web config" in appsettings add keys
-----------------------------------------------
// put this class on same login page
Public Class UserInfo
Public Property IsValid As Boolean
Public Property Token As String
Public Property NationalID As String
Public Property DisplayName As String
Public Property FirstName As String
Public Property LastName As String
Public Property Sid As String
Public Property Email As String
Public Property UserTypeID As Integer?
Public Property Mobile As String
End Class
Public Class AjaxWrapper(Of T)
Public d As T
End Class
-------------------------------------------
// In Login Page In load Function
If Not (Request.QueryString("Token") Is Nothing) Then
Dim Token As String = Request.QueryString("Token").ToString()
Dim ClientID As String = WebConfigurationManager.AppSettings("ClientID").ToString()
Dim ClientSecret As String = WebConfigurationManager.AppSettings("ClientSecret").ToString()
Dim WebServiceURL As String = WebConfigurationManager.AppSettings("WebServiceURL").ToString()
Dim SrtWebServiceURL As String = String.Format(WebServiceURL & "/GetUserInfoFromApp?Token='{0}'&ClientID='{1}'&ClientSecret='{2}'", HttpUtility.UrlEncode(Token), HttpUtility.UrlEncode(ClientID), HttpUtility.UrlEncode(ClientSecret))
Dim wc As WebClient = New WebClient()
Dim data As String = wc.DownloadString(SrtWebServiceURL)
Dim result As UserInfo = Newtonsoft.Json.JsonConvert.DeserializeObject(Of AjaxWrapper(Of UserInfo))(data).d
If result IsNot Nothing AndAlso result.IsValid Then
// Token is valid
// here you got the NationalID of user result.NationalID
// your turn now to enter user to your system
Else
// You know from here "Invalid token or entry"
// let user show your login page cause he is not authorized as SSO
End If
End If
---------------