-
Notifications
You must be signed in to change notification settings - Fork 4
User authentication
The Last.fm API provides 3 ways to do user authentication:
- desktop application oriented
- web application oriented
- mobile application oriented
Out of these options only mobile application oriented is fully handled in Lib.fm. For desktop and web authentication the library offers only partial support (read below for details).
There is no requirement to use a specific authentication path for any application type. These are only suggestions based on commonly available resources.
Desktop application authentication is a 4 stage process:
- Create a token with
LibFM.get_token
- Use
LibFM.token_authorization_url
to create an authorization URL - Open the autorization URL in a browser; the user will use this page to grant access to your application
- After the user has granted access use
LibFM.create_session
to create a session
Web application authentication is also a 4 stage process:
- Use
LibFM.token_request_url
to create an authorization URL - Redirect the user to the authorization URL
- Receive the token either on your application's default callback or on the callback URL specified in
LibFM.token_request_url
(the token is provided in a GET parameter named 'token'). - Use
LibFM.create_session
to create a session
Mobile authentication is the easiest authentication path to implement:
- Create a session with
LibFM.create_mobile_session
The downside is that users are asked to provide their Last.fm username and password directly to your application. If possible you should use the other authentication methods.