// Path: Simperium/src/main/java/com/simperium/util/AuthUtil.java
// public class AuthUtil {
// 
//     public static final String USERNAME_KEY = "username";
//     public static final String ACCESS_TOKEN_KEY = "access_token";
//     public static final String PASSWORD_KEY = "password";
//     public static final String USERID_KEY = "userid";
//     public static final String PROVIDER_KEY = "provider";
// 
//     public static JSONObject makeAuthRequestBody(User user){
//         return makeAuthRequestBody(user.getEmail(), user.getPassword());
//     }
// 
//     public static JSONObject makeAuthRequestBody(CharSequence username, CharSequence password){
//         JSONObject body = new JSONObject();
//         try {
//             if (username != null) body.put(USERNAME_KEY, username);
//         } catch (JSONException e) {
//             // could not set username
//         }
//         try {
//             if (password != null) body.put(PASSWORD_KEY, password);
//         } catch (JSONException e) {
//             // could not set password
//         }
//         return body;
//     }
// 
// }


import com.simperium.util.AuthUtil;
import org.json.JSONObject;
package com.simperium.client;



public class AuthResponseHandler {
    private AuthProvider mProvider;
    private AuthResponseListener mListener;
    private User mUser;

    public AuthResponseHandler(User user, AuthResponseListener listener, AuthProvider provider) {
        mUser = user;
        mListener = listener;
        mProvider = provider;
    }

    public void onResponse(JSONObject response){
// Path: Simperium/src/main/java/com/simperium/util/AuthUtil.java
// public class AuthUtil {
// 
//     public static final String USERNAME_KEY = "username";
//     public static final String ACCESS_TOKEN_KEY = "access_token";
//     public static final String PASSWORD_KEY = "password";
//     public static final String USERID_KEY = "userid";
//     public static final String PROVIDER_KEY = "provider";
// 
//     public static JSONObject makeAuthRequestBody(User user){
//         return makeAuthRequestBody(user.getEmail(), user.getPassword());
//     }
// 
//     public static JSONObject makeAuthRequestBody(CharSequence username, CharSequence password){
//         JSONObject body = new JSONObject();
//         try {
//             if (username != null) body.put(USERNAME_KEY, username);
//         } catch (JSONException e) {
//             // could not set username
//         }
//         try {
//             if (password != null) body.put(PASSWORD_KEY, password);
//         } catch (JSONException e) {
//             // could not set password
//         }
//         return body;
//     }
// 
// }


// Path: Simperium/src/main/java/com/simperium/client/AuthResponseHandler.java
import com.simperium.util.AuthUtil;
import org.json.JSONObject;

package com.simperium.client;



public class AuthResponseHandler {
    private AuthProvider mProvider;
    private AuthResponseListener mListener;
    private User mUser;

    public AuthResponseHandler(User user, AuthResponseListener listener, AuthProvider provider) {
        mUser = user;
        mListener = listener;
        mProvider = provider;
    }

    public void onResponse(JSONObject response){
        if (!response.optString(AuthUtil.USERID_KEY).isEmpty() && !response.optString(AuthUtil.ACCESS_TOKEN_KEY).isEmpty()) {