'To get Access Code 'Note we pass extra params through the querystring to retrive additional objects after postback using UrlEncode 'remember UrlDecode at the other end... Dim redirectURI As String = String.Format("{0}?client_id={1}&response_type={2}&scope={3}&redirect_uri={4}", AuthorizationEndPoint, ClientId, "code", "/authenticate", HttpUtility.UrlEncode("~/ORCIDAuthentication.aspx?id1=" & 1 & "&id2=" & 2)) 'Open Dialog with Url for Access Code -> we use Telerik RadWindow but this can be a page... 'link Button onclick... lbtnGetAuthenticationProvider.Attributes.Add("onclick", "openRadWindow('" & redirectURI & "', '" & [yourTextHere] & "'); return false;") 'Authorize with ORCID... -> return to RedirectURI... '''In RedirectURI page [ORCIDAuthentication.aspx] we get extra params from query string & fluent specific objects 'Inside Page Load, if not page.ispostback... If Not String.IsNullOrWhiteSpace(Code) Then 'code is returned on the QueryString by ORCID 'This must be the same as the redirectURI passed in to get the Access code Dim redirect_uri As String = HttpUtility.UrlEncode("~/ORCIDAuthentication.aspx?id1=" & 1 & "&id2=" & 2) ' Get Token Dim AuthToken As Object = GetAccessToken(Code, ORCIDObject, redirect_uri) 'Make sure token has been returned If Not AuthToken Is Nothing Then Dim orcidID As String = AuthToken("orcid") 'Also save token as it exists with long life (as advised by ORCID...) End If End If Public Function GetAccessToken(ByVal AuthCode As String, ByVal AuthProvider As AuthenticationProvider, ByVal Redirect_Uri As String, Optional ByVal personId As Integer = 0) As Object Dim token As New Object Using client As New WebClient() Try Dim response As Byte() = client.UploadValues(AuthProvider.TokenEndPoint, New NameValueCollection() From { {"client_id", AuthProvider.ClientId}, {"client_secret", AuthProvider.Secret}, {"grant_type", "authorization_code"}, {"code", AuthCode}, {"redirect_uri", Redirect_Uri} }) Dim jsc As New System.Web.Script.Serialization.JavaScriptSerializer() Dim result As String = System.Text.Encoding.UTF8.GetString(response) token = jsc.Deserialize(Of Object)(result) Catch ex As Exception Return Nothing End Try End Using Return token End Function