發表文章

目前顯示的是 6月, 2012的文章

[JS] [Node.js] facebook authentication demo

圖片
流程 這是不使用任何facebook sdk的方法 首先要去fb新開一個app https://developers.facebook.com/apps/3xxx21/summary?save=1 在裡面填入app的uri, eg. http://localhost:8888/demo.html (注意:之後app要redirect_uri的uri,必須填在裡面) 參考 Client-side authentication without the JS SDK 要填入的只有以下項目: https://www.facebook.com/dialog/oauth?    client_id=YOUR_APP_ID   &redirect_uri=YOUR_REDIRECT_URI   &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES   &response_type=token 所以我們知道要用app redirect此url到fb做認證 https://www.facebook.com/dialog/oauth?client_id=3xxx021&redirect_uri=http://localhost:8888/demo.html&response_type=token 在認證成功後,fb會redirect到你指定出的redirect_uri, http://localhost:8888/demo.html#access_token=AAAxxxxWPTM2xF&expires_in=6807 由url hash可以得到access_token 就可以使用fb graph api了 可以參考fb的流程圖: demo app.js var server,    ip   = "localhost",    port = 8888,    http = r...

[JS] [Node.js] Express error on windows evirement

說明 'http://user:pass@host.com:8080/p/a/t/h?query=string#hash' The issue is that request.url doens't contain the hash, because the browser typically doesn't send the hash, so the server doesn't have it. 瀏覽器送給server的request.url不會包含hash 討論串範例 can't get the hash of a url I'm trying to get the hash of a url that's being passed in to my simple http server, but the only params that appear to be in the uri are the path and href. The following is my code: var http = require('http'),     url = require('url'),     path = require('path'); http.createServer( function(request, response) {     var uri = url.parse(request.url); console.log( uri.hash );     response.writeHead(200, {'Content-Type': 'text/plain'});     response.end( uri.href ); }).listen(8080); On the terminal, no uri.hash is being output, just undefined. Re: Re: can't get the hash of a url On Fri, Aug 13, 2010 at 22:30, markc < mconstable@....