/** * Authorize a user with a session token. On success, this saves the session to disk, so you can * retrieve the currently logged in user using {@link #getCurrentUser}. * <p/> * This is preferable to using {@link #become}, unless your code is already running from a * background thread. * * @param sessionToken The session token to authorize with. * @param callback callback.done(user, e) is called when the authorization completes. */ public static void becomeInBackground(final String sessionToken, LogInCallback callback) { ParseTaskUtils.callbackOnMainThreadAsync(becomeInBackground(sessionToken), callback); }
/** * Authorize a user with a session token. On success, this saves the session to disk, so you can * retrieve the currently logged in user using {@link #getCurrentUser}. * <p/> * Typically, you should use {@link #becomeInBackground} instead of this, unless you are managing * your own threading. * * @param sessionToken The session token to authorize with. * @return The user if the authorization was successful. * @throws ParseException Throws an exception if the authorization was unsuccessful. */ public static ParseUser become(String sessionToken) throws ParseException { return ParseTaskUtils.wait(becomeInBackground(sessionToken)); }
ParseUser.becomeInBackground("sessionToken", new LogInCallback() { @Override public void done(ParseUser user, ParseException e) {
@NonNull @CheckReturnValue public static Single<ParseUser> become(@NonNull final String sessionToken) { return RxTask.single(() -> ParseUser.becomeInBackground(sessionToken)); }