net.dontdrinkandroot.lastfm.api.model

## Class Auth

- java.lang.Object
- - net.dontdrinkandroot.lastfm.api.model.Auth

    public class Auth
    extends Object

### Constructor Summary

Constructors
Constructor and Description
`Auth()`

### Method Summary

Methods
`static String` `generateMobileToken(String username, String password)` This method can generate a token as required by `getMobileSession(java.lang.String, java.lang.String)`.
`static AuthenticatedGetQuery<Session>` `getMobileSession(String username, String authToken)` Create a web service session for a user.
`static AuthenticatedGetQuery<Session>` `getSession(String token)` Fetch a session key for a user.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Auth

    public Auth()

### Method Detail

#### getMobileSession

    public static AuthenticatedGetQuery<Session> getMobileSession(String username,
                                                  String authToken)

Create a web service session for a user. Used for authenticating a user when the password can be inputted by the user. Only suitable for standalone mobile devices. See the authentication how-to for more.

Parameters:
  `username` - The last.fm username. (Required).
  `authToken` - A 32-byte ASCII hexadecimal MD5 hash of the last.fm username and the user's password hash. i.e. md5(username + md5(password)), where '+' represents a concatenation. This can also be generated by `generateMobileToken(java.lang.String, java.lang.String)` (Required).
Returns:

#### generateMobileToken

    public static String generateMobileToken(String username,
                             String password)

This method can generate a token as required by `getMobileSession(java.lang.String, java.lang.String)`.

Parameters:
  `username` - The username of the last.fm user to authenticate.
  `password` - The password of the last.fm user to authenticate
Returns:
  The token needed to acquire a mobile session.

#### getSession

    public static AuthenticatedGetQuery<Session> getSession(String token)

Fetch a session key for a user. The third step in the authentication process. See the authentication how-to for more information.

Parameters:
  `token` - A 32-character ASCII hexadecimal MD5 hash returned by step 1 of the authentication process (following the granting of permissions to the application by the user) (Required).
Returns: