Classic ASP
Classic ASP
Generate OAuth 1.0 Signature
Demonstrates how to generate an OAuth 1.0 signature.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
success = 0
set oauth = Server.CreateObject("Chilkat.OAuth1")
' Set input parameters:
oauth.OauthVersion = "1.0"
oauth.OauthMethod = "GET"
oauth.OauthUrl = "http://echo.lab.madgex.com/echo.ashx"
oauth.ConsumerKey = "key"
oauth.ConsumerSecret = "secret"
oauth.Token = "accesskey"
oauth.TokenSecret = "accesssecret"
oauth.Nonce = "01020304050607080102030405060708"
oauth.Timestamp = "1441659763"
' Can be "HMAC-SHA1", "HMAC-SHA256", "RSA-SHA1", or "RSA-SHA2"
oauth.SignatureMethod = "HMAC-SHA256"
success = oauth.Generate()
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( oauth.LastErrorText) & "</pre>"
Response.End
End If
' Examine the various outputs:
Response.Write "<pre>" & Server.HTMLEncode( oauth.QueryString) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( oauth.BaseString) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( oauth.HmacKey) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( oauth.Signature) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( oauth.EncodedSignature) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( oauth.AuthorizationHeader) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( oauth.GeneratedUrl) & "</pre>"
%>
</body>
</html>