Skip to content

Autocomplete for SMS OTP #3777

@zawislak-pawel

Description

@zawislak-pawel

Describe the bug

We would like to integrate autocomplete field in OKTA widget.
To do this we need to add autocomplete="one-time-code" attribute to HTML input.
Currently we use classicEngine (config.useClassicEngine = true;) widget and I couldn't make it work.

I was trying to play with feature: features.disableAutocomplete.

Also I was trying to add hook to afterRender via code:

const oktaSignIn = new OktaSignIn(config);
oktaSignIn.on('afterRender', afterRender);
oktaSignIn.on('afterError', redirectToLoginPage);

function afterRender() {
    const otpInput = document.querySelector('.o-form-input-name-answer > input');
    if (otpInput) {
        otpInput.setAttribute('autocomplete', 'one-time-code');
    }
}

Unfortunately above solutions doesn't seem to work.
afterRender - solution seems to work (not override) for totp app, but for sms it setsautocomplete="off" - my assumption is that react for some reason recreates input element.

Reproduction Steps

Set afterRenderer function to override attribute autocomplete.

SDK Versions

7.12.2

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions