package com.facebook;

import android.os.Bundle;
import com.facebook.AccessToken.AccessTokenCreationCallback;
import com.facebook.internal.Utility.GraphMeRequestWithCacheCallback;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.sqlitelint.config.SharePluginInfo;
import java.util.Date;
import org.json.JSONException;
import org.json.JSONObject;

class AccessToken$1 implements GraphMeRequestWithCacheCallback {
    final /* synthetic */ AccessTokenCreationCallback val$accessTokenCallback;
    final /* synthetic */ String val$applicationId;
    final /* synthetic */ Bundle val$extras;

    AccessToken$1(Bundle bundle, AccessTokenCreationCallback accessTokenCreationCallback, String str) {
        this.val$extras = bundle;
        this.val$accessTokenCallback = accessTokenCreationCallback;
        this.val$applicationId = str;
    }

    public final void onSuccess(JSONObject jSONObject) {
        AppMethodBeat.i(71508);
        try {
            this.val$extras.putString("user_id", jSONObject.getString(SharePluginInfo.ISSUE_KEY_ID));
            this.val$accessTokenCallback.onSuccess(AccessToken.access$000(null, this.val$extras, AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date(), this.val$applicationId));
            AppMethodBeat.o(71508);
        } catch (JSONException e) {
            this.val$accessTokenCallback.onError(new FacebookException("Unable to generate access token due to missing user id"));
            AppMethodBeat.o(71508);
        }
    }

    public final void onFailure(FacebookException facebookException) {
        AppMethodBeat.i(71509);
        this.val$accessTokenCallback.onError(facebookException);
        AppMethodBeat.o(71509);
    }
}
