Class: Shortwave::Authentication::Web
- Defined in:
- lib/shortwave/authentication.rb
Overview
Authentication for web applications. Send your user to the page given by uri
and use the token provided to your callback url as an argument to authenticate
Instance Attribute Summary
Attributes inherited from Session
Instance Method Summary collapse
-
#authenticate(token) ⇒ Object
Gets an authenticated session key.
-
#uri ⇒ Object
The uri you should direct users to in their web browser, so they can authenticate.
Methods inherited from Session
#initialize, #merge!, #signature, #signed_in?
Constructor Details
This class inherits a constructor from Shortwave::Authentication::Session
Instance Method Details
#authenticate(token) ⇒ Object
Gets an authenticated session key. Call after the user has logged in at uri
with the token returned to your callback uri.
86 87 88 |
# File 'lib/shortwave/authentication.rb', line 86 def authenticate(token) parse_session_response(@facade.session(token)) end |
#uri ⇒ Object
The uri you should direct users to in their web browser, so they can authenticate. If successful, the callback url defined in your api account will be called, with a token parameter. Pass this token to the authenticate method.
80 81 82 |
# File 'lib/shortwave/authentication.rb', line 80 def uri "http://www.last.fm/api/auth/?api_key=#{@api_key}" end |