Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

How to set loginHint ? #97

Open
duymap opened this issue Apr 25, 2019 · 1 comment
Open

How to set loginHint ? #97

duymap opened this issue Apr 25, 2019 · 1 comment

Comments

@duymap
Copy link

duymap commented Apr 25, 2019

I tried to set loginHint as below code but it does not work:

AuthenticationPayload payload = new AuthenticationPayload.Builder().setLoginHint().build();

    mOktaAuth.login(
            this,
            PendingIntent.getActivity(this, 0, completionIntent, 0),
            PendingIntent.getActivity(this, 0, cancelIntent, 0), payload
    );

Looking code deeply found weird code in OktaAutheApp.createAuthRequest:

        if (payload != null) {
            authRequestBuilder.setAdditionalParameters(payload.getAdditionalParameters());
            if (!TextUtils.isEmpty(payload.toString())) {
                authRequestBuilder.setState(payload.getState());
            }

            if (!TextUtils.isEmpty(payload.getLoginHint())) {
                authRequestBuilder.setLoginHint(payload.getLoginHint());
            }
        }

        this.mAuthRequest.set(authRequestBuilder.build());```

Why code checking payload.toString() and setState ? Why this is not !TextUtils.isEmpty(payload.getState())
@FeiChen-okta
Copy link
Contributor

You have to set the state also.

        AuthenticationPayload payload = new AuthenticationPayload.Builder()
                .setLoginHint("yourHint")
                .setState("yourState")
                .build();

The SDK tries to use the state and the hint if a payload is passed in.

Why code checking payload.toString() and setState ? Why this is not !TextUtils.isEmpty(payload.getState())

I don't know 😒

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants