liblastfm-0.3.2.0: Lastfm API interface

Safe HaskellNone

Network.Lastfm.Authentication

Contents

Description

Lastfm authentication procedure helpers

Basically, lastfm provides 3 ways to authenticate user:

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__" <* json
Just (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__"  <* json
Just (Object fromList [("session",Object fromList [("name",String "__USER__"),("subscriber",String "0"),("key",String "__SESSION_KEY__")])])

Synopsis

Helpers

getToken :: Request f (APIKey -> Ready)Source

Get authorization token

getSession :: Request f (Token -> APIKey -> Sign)Source

Get session key

getMobileSession :: Request f (Username -> Password -> APIKey -> Sign)Source

Get session key

link :: Request f a -> StringSource

Construct link user should follow to approve application