EpicPandaForce
EpicPandaForce

Reputation: 81568

AndroidBootstrap: Authentication - how does it work?

I was trying to use http://www.androidbootstrap.com/ to bootstrap a new Android application. It creates a project with Otto, Dagger, Butterknife, Retrofit, and some other nifty stuff while also creating sample code on how to use it. It's really useful, as it sets up the annotation processing and everything in the Gradle build files for Android Studio to import it easily, it's really neat.

However, I'm at a loss with the login screen.

    /**
     * This method gets called when the
     * methods gets invoked.
     * This happens on a different process, so debugging it can be a beast.
     *
     * @param response
     * @param account
     * @param authTokenType
     * @param options
     * @return
     * @throws NetworkErrorException
     */
    @Override
    public Bundle getAuthToken(final AccountAuthenticatorResponse response,
                               final Account account, final String authTokenType,
                               final Bundle options) throws NetworkErrorException {

        Ln.d("Attempting to get authToken");

        final String authToken = AccountManager.get(context).peekAuthToken(account, authTokenType);

        final Bundle bundle = new Bundle();
        bundle.putString(KEY_ACCOUNT_NAME, account.name);
        bundle.putString(KEY_ACCOUNT_TYPE, Constants.Auth.BOOTSTRAP_ACCOUNT_TYPE);
        bundle.putString(KEY_AUTHTOKEN, authToken);

        return bundle;
    }

    @Override
    public String getAuthTokenLabel(final String authTokenType) {
        return authTokenType.equals(Constants.Auth.AUTHTOKEN_TYPE) ? authTokenType : null;
    }

    @Override
    public Bundle hasFeatures(final AccountAuthenticatorResponse response, final Account account,
                              final String[] features) throws NetworkErrorException {
        final Bundle result = new Bundle();
        result.putBoolean(KEY_BOOLEAN_RESULT, false);
        return result;
    }

    @Override
    public Bundle updateCredentials(final AccountAuthenticatorResponse response,
                                    final Account account, final String authTokenType,
                                    final Bundle options) {
        return null;
    }
}

I cannot authenticate it and actually "log in".

So my questions are the following:

Upvotes: -2

Views: 185

Answers (1)

EpicPandaForce
EpicPandaForce

Reputation: 81568

As written on https://github.com/AndroidBootstrap/android-bootstrap - the login credentials are

username: [email protected]

password: android

It authenticates you against Parse.com as that is what it is set up against as a demo.

This is using an account authenticator which was added in Android v2.0, and adds the account to the Accounts in Android.

More information is available here:

http://udinic.wordpress.com/2013/04/24/write-your-own-android-authenticator/ http://www.jiahaoliuliu.com/2012/05/android-account-manager-part-i.html http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/

Upvotes: 0

Related Questions