olams/GwtFB — Issue #4: Any reason not to wrap AuthResponse?
Author: kozura
Created: 2012-01-12 20:02:18+00:00
State: open

Instead of just generic JavascriptObject, why not wrap AuthResponse and include the code to make it useful, since this is what is returned by all the login/logout type of calls.

ie:

```java
/**
* Return status for event callbacks dealing with authResponse
*{
* status: "", // Current status of the session
* authResponse: { // Information about the current session
* userID: "" // String representing the current user's ID
* signedRequest: "", // String with the current signedRequest
* expiresIn: "", // UNIX time when the session expires
* accessToken: "", // Access token of the user
* }
*}
*/
public final class AuthResponse extends JavaScriptObject
{
public static final String STATUS_CONNECTED = "connected";
public static final String STATUS_NOTCONNECTED = "notConnected";
public static final String STATUS_UNKNOWN = "unknown";

protected AuthResponse() {}

public native String getStatus()
/*-{
return this.status;
}-*/;

public native String getUserID()
/*-{
return this.authResponse ? this.authResponse.userID : "";
}-*/;

public native String getAccessToken()
/*-{
return this.authResponse ? this.authResponse.accessToken : "";
}-*/;

public native Long getExpiration()
/*-{
return this.session ? this.session.expires : "";
}-*/;

public native String getSignedRequest()
/*-{
return this.authResponse ? this.authResponse.signedRequest : "";
}-*/;
}
```