How to access to registration via login Widget?

There is no built in way to achieve this. See related threads about this question for reference/options:

and an older GH thread about this request: Initialize Widget directly in registration view · Issue #587 · okta/okta-signin-widget · GitHub


One of the more common solutions I’ve heard of is to emulate the user clicking this button so the registration view is shown instead. See some example code for what this looks like below (note that the class name may vary depending on the widget version being used):

// Render the Okta Sign-In Widget
var oktaSignIn = new OktaSignIn(config);

oktaSignIn.on('afterRender', function (data) {
  // This is the code that makes it look as if the Okta Sign-In Widget has been loaded to the "Registration" view
  const view = data.controller;
  if(view == 'primary-auth') {
    if(registrationNotClicked) {
      registrationNotClicked = false;
      document.getElementsByClassName("registration-link")[0].click();
    }