Jan 2025【日本東北】溫泉三昧之旅① 在大雪飄落的雪國,追尋秘湯之宿與極上美食(秋田~探訪有日本溫泉界頂點之稱的秘湯乳頭溫泉鶴之湯)

圖片
飛機穿過厚重的雲層,眼前的世界瞬間變成一片白茫茫。大片的雪花,像是鵝毛般漫天飛舞,所有景物都披上了一層潔白的冬衣,只剩下模糊的輪廓,分不清是房屋、樹木還是道路。 下了飛機,一股寒風迎面而來,我不禁打了個寒顫,但也同時被眼前這片銀裝素裹的世界深深吸引。這就是東北的冬天啊!雖然寒冷,但卻充滿了獨特的魅力,如同一個冰雪的童話世界,等待著我們去探索。 我知道,這場大雪只是個開始,接下來幾天的旅程,將會是一場與冰雪共舞之旅。但我已經迫不及待地想要擁抱這片雪國大地,體驗這份獨一無二的冬季風情。 秋田位於日本本州島的北部,瀕臨日本海,冬天受到西伯利亞冷氣團的影響,降雪量非常豐沛。聽說這裡的雪可以堆積到好幾公尺高呢! 秋田的冬天,雖然寒冷,卻充滿了活力和熱情。首先,你可以在森吉山滑雪場滑雪,從雪道上俯衝而下,感受速度與激情!聽說那裡的樹冰也很有名,可惜這次我們沒時間去欣賞。 除了滑雪,秋田還有許多有趣的冬季活動。在橫手市的「橫手雪屋祭」,你可以看到各式各樣的雪屋,晚上點上燈,更是夢幻!聽說在雪屋裡還可以喝甜酒、吃麻糬呢! 當然,來到秋田,也別忘了品嚐當地的冬季美食。熱騰騰的米棒鍋,配上秋田特產的比內地雞和新鮮蔬菜,暖胃又暖心!還有,在寒冬中泡個暖呼呼的溫泉,更是人生一大享受! 剛踏進秋田機場的入境大廳,我就被眼前一個氣勢磅礡的「生剝鬼」給震懾住了!他身披粗獷的稻草蓑衣,手持木棒和裝滿白色紙片的桶子,臉上那副紅色面具更是令人印象深刻:獠牙外露、怒目圓睜,彷彿下一秒就要衝過來似的。 「生剝鬼」(なまはげ)是秋田縣男鹿半島的傳統民俗人物,也是當地家喻戶曉的傳奇角色。據說,生剝鬼是山神的使者,每年除夕夜都會來到村莊,挨家挨戶地驅趕懶惰和邪惡,為人們帶來好運和豐收。他們會大聲吼叫:「有沒有愛哭的小孩?有沒有不聽話的小孩?」,嚇唬孩子們要乖乖聽話,認真學習。 雖然生剝鬼看起來很可怕,但他們其實是善良的,是來保護人們的。生剝鬼的形象也反映了秋田人民勤勞勇敢、不畏艱難的精神。 生剝鬼的故事世代相傳,至今已有數百年的歷史。每年除夕夜,男鹿半島的村民都會舉行「生剝鬼節」,年輕人會裝扮成生剝鬼的樣子,挨家挨戶地拜訪,祈求來年平安順遂。 接著,我們從機場搭乘路線巴士來到了秋田車站,上次來造訪這裡,已是十年前的往事了。一踏進車站,我就被眼前這隻巨大的秋田犬玩偶給吸引住!它憨態可掬地趴在車站大廳中央,吐著粉嫩...

Connect to the Foursquare API via OAuth in your Rails application

OAuth is an open authentication protocol that allows secure API communication without the necessity of continually passing a username and password with each request. The idea for OAuth was conceived in 2006 by a group of individuals working on the Twitter implementation of OpenID. 

After reviewing both OpenID and other existing industry practices, such as Amazon Web Services API and Flickr API, it was decided that a proposal should be written for a new open protocol for application authentication.

OAuth has been widely adopted among major web services. Twitter, not only implementing OAuth as its primary API authentication method, but using it as the basis for its “Sign in with Twitter” service. Today, you’ll also find the protocol used by Facebook, Google, Yahoo, LinkedIn, and many others.

Foursquare is a new and rapidly growing social utility whose potential for mash-ups with other applications is limited only by one’s own imagination. The Foursquare platform implements the OAuth 2.0 standard, so users can authorize applications to access Foursquare resources on their behalf without revealing their passwords or other credentials to those applications. The foursquare API gives you access to all of the data used by the foursquare mobile applications, and, in some cases, even more.



I have been experimenting with the Foursquare API for a few days now, and I wanted to show you how you can implement use Foursquare in your Rails application using OAuth 2.0 (This is a very simple Rails application that connects to the Foursquare API using Quimby [http://github.com/groupme/quimby]). It is working fine as I'm using Rails 2.3.8 on ruby 1.8.7 and it also work with Rails 3!

I'm going to just give you the concept for this post. If you have no prior experience with Ruby or you are new to Rails, as you read this post, don't get use these code directly, it will not work for your blank Rails application.

Below is a general overview for an OAuth connection: 
1.Send request to target website for token, with the server's client_id & secret_id 
2.Redirect user to authorize page with token (and callback url)
3.After user confirm, user will be redirect to the callback page with a access_token
4.Save the access_token, and free to call target server for user data.


You will need a Foursquare account to obtain your key and secret in the first place. Visit https://foursquare.com/oauth to register your Rails application and obtaining your API credentials, where you need to provide an app name (ex: Railscode), a website url (ex: http://localhost:3000) and a callback URL (ex: http://localhost:3000/fsq_callback).  It’s a free signup, and if you wish to work on the API I’m sure you’ve already had an interest in the application! After registration, you should see something like this:



Copy your Foursquare App Client ID & Client Secret and paste it into your environment.rb or maybe config_foursquare.yml. The callback URL is the location your users will be sent after they authenticate on Foursquare’s site.

Next run rails script to generate a migration file:
$ script/generate migration add_foursquare_to_users



And we have to install the following ruby gems:



We need to be able to intercept this redirect, capture the token, and store it so we can begin interacting with Foursquare. Add the following method to the application controller:



Next we need to write a callback method in the fsq_oauth_controller.rb. Once we’ve retrieved the code from the Foursquare server, we can exchange it for an access token.



Add the following line in the routes.rb:



In order to retrieve an access token, we need to redirect the user to the Foursquare authorization URL (More info can be found on https://developer.foursquare.com/docs/oauth.html). we can add the foursquare connect button in the view page:



When pressing the login button, you can login with your Foursquare credentials!


Now that the app has an access token, we can launch our main activity and start interacting with Foursquare.

This has been a basic look into getting started with Foursquare’s API. OAuth is a very powerful open protocol for connecting into larger social communities. It offers the most secure solutions for both users and web masters. The Foursquare Developers center is an amazing tool for newbies.Scour the resources and look up and function calls you may be interested in working with. Similarly the official OAuth website has some terrific readings outlining the purpose and practical solutions for the protocol.

熱門文章

Jan 2025【日本東北】溫泉三昧之旅① 在大雪飄落的雪國,追尋秘湯之宿與極上美食(秋田~探訪有日本溫泉界頂點之稱的秘湯乳頭溫泉鶴之湯)

Feb, 2024【台中西區】桃太郎日本料理|隱身巷弄裡的39年老字號無菜單料理|食材新鮮、自然美味

Mar 2025【新竹五峰】油羅山森呼吸:擁抱原始柳杉林秘境之美(羅山林道第一登山口往返)

April, 2023【彰化芬園】步道平坦好走!彰化八卦山「挑水古道」+十八觀音步道、碧山古道O形環走

Jan 2025【苗栗泰安】泰安警光山莊泡湯&彰化CP值極高的日本料理|沐藏料理所X海龍王|彰化板前料理 ♨️🍁🥢🍲

2019.10.9~13【令和元年の紅葉の山旅へ PART①】秋の贅沢、黒部川の源流へ北アルプス深部を縦走5日間!Day0、Day1(前泊、折立~藥師岳山莊)

Aug, 2023【桃園大溪】桃園小百岳編號23-溪洲山步道|適合訓練腳力、還能觀賞石門水庫的山水景色

Jan 2025【日本東北】溫泉三昧之旅② 在大雪飄落的雪國,追尋秘湯之宿與極上美食(仙台~品嚐極上米澤牛&奧羽的百年藥湯-鎌先溫泉)

Nov 2024【陽明山溫泉】老字號「馬槽花藝村」的溫泉管線已恢復|在木造山景湯屋享受半露天硫磺溫泉

Mar 2025【桃園復興】高遶溪古圳步道健行(第二期步道已完工,全長2.6公里)|隱藏版道地新疆料理~胡同彭家老舖新疆拉麵

文章列表

Contact

名稱

以電子郵件傳送 *

訊息 *