| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Lastfm.Authentication
Contents
Description
Lastfm authentication procedure helpers
Basically, lastfm provides 3 ways to authenticate user:
- web application - http://www.last.fm/api/webauth
- desktop application - http://www.last.fm/api/desktopauth
- modile application - http://www.last.fm/api/mobileauth
Note that you can use any of them in your application despite their names
How to get session key for yourself for debug with GHCi:
>>>import Network.Lastfm>>>import Network.Lastfm.Authentication>>>:set -XOverloadedStrings>>>lastfm $ getToken <*> apiKey "__API_KEY__" <* jsonJust (Object fromList [("token",String "__TOKEN__")])>>>putStrLn . link $ apiKey "__API_KEY__" <* token "__TOKEN__"http://www.last.fm/api/auth/?api_key=__API_KEY__&token=__TOKEN__>>>-- Click that link ^^^>>>lastfm . sign "__SECRET__" $ getSession <*> token "__TOKEN__" <*> apiKey "__API_KEY__" <* jsonJust (Object fromList [("session",Object fromList [("name",String "__USER__"),("subscriber",String "0"),("key",String "__SESSION_KEY__")])])