| 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>>>con <- newConnection>>>lastfm con $ getToken <*> apiKey "__API_KEY__" <* jsonRight (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 con $ sign "__SECRET__" $ getSession <*> token "__TOKEN__" <*> apiKey "__API_KEY__" <* jsonRight (Object (fromList [("session",Object (fromList [("subscriber",String "0"),("key",String "__SESSION_KEY__"),("name",String "__USER__")]))]))