본문 바로가기

▣▣ SNS API ▣▣

Twitter oAuth ASP API


oAuth ASP API 

http://scottdesapio.com/VBScriptOAuth/

QNA

http://stackoverflow.com/questions/664462/classic-asp-twitter-libraries

Source

http://scottdesapio.com/VBScriptOAuth/oAuthASPExample.zip 

 


1.소스를 다운 설치.

최상위 폴더명을 기본값 (읽기전용 확인 >> 해제)

 oAuthASPExample/

2.oAuthASPExample/js/base.js 수정

LINE  169 ~ 170번   Domain변경 127.0.0.1 -> 다른 도메인

3.oAuthASPExample/twitter/_config.asp ( 트윗발급 인증키값 적용)

Const OAUTH_EXAMPLE_CONSUMER_KEY = "" ' <-- YOUR CONSUMER KEY

Const OAUTH_EXAMPLE_CONSUMER_SECRET = "" ' <-- YOUR CONSUMER SECRET

twitter application registration  :  http://dev.twitter.com/apps/new

>> registration 시 Callback URL  :

http://DomainName/oAuthASPExample/twitter/callback.asp


4. 에러페이지 확인 

oAuthASPExample/twitter/authenticate.asp

>> 해당 코드
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' set the redirect url
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim strRedirectURL : If Not IsNull(objOAuth.ErrorCode) Then
 ' set redirect to generic error (do specific error handling here)

'response.write "<br>objOAuth.ErrorCode : " & objOAuth.ErrorCode & "<br>"
'Response.end

 strRedirectURL = OAUTH_EXAMPLE_ERROR_URL
Else
 ' store the request token
 Session(OAUTH_TOKEN_REQUEST) = strRequestToken
 
 ' set redirect to authenticate
 strRedirectURL = TWITTER_OAUTH_URL_AUTHENTICATE & _
  "?oauth_token=" & strRequestToken & "&force_login=" & LCase(CStr(OAUTH_EXAMPLE_FORCE_LOGIN))
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
5. Error 처리

oAuthASPExample/oauth/cLibOAuth.asp

Dim objXMLHTTP : Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")

Error No 402 >>

Dim objXMLHTTP : Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")


6. Encoding Process

파일 형식   :  UTF - 8

oAuthASPExample/oauth/_inc/_base.asp

>> 추가 Coding
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Response.Charset = "UTF-8" %>
<!--#include file="constants_oauth.asp"-->
<!--#include file="constants_twitter.asp"-->
<!--#include file="hex_sha1_base64.asp"-->

'▣▣ SNS API ▣▣' 카테고리의 다른 글

트위터 API 관련 001  (0) 2010.11.30