Auth0 iOS Swift - Universal web Login - How to display Registration screen

The Universal login page contains both login and registration in the same screen (divided with tabs). Suppose I want to have two buttons in the app, one for login and another one for registration, it is possible to add some parameter to the webAuth() method to open the web page showing directly the registration screen (its the same screen but with that tab already selected)?

Hi @fgonzalez

With the Universal Login it uses the Auth0 Lock widget so any configuration options available for the Lock widget can be set using the Auth0 Management dashboard under the Hosted Pages section.

In there you can pass extra config parameters inside the javascript. The particular config parameter you are after is initialScreen.

Now to pass a value to this parameter from the client side you’ll have to customize the Universal Login to load the value from the extraParams object, e.g.

    var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
        ...
        initialScreen: config.extraParams.initialScreen || 'login'
        ...
    }

and then in your Swift code where you do your webAuth() call you’ll add an extra setting called parameters, e.g.

Auth0
    .webAuth()
    .parameters(["initialScreen": "signUp"])
    .audience("https://{YOUR_AUTH0_DOMAIN}/userinfo")
    .start { result in
        switch result {
        case .success(let credentials):
            print("Obtained credentials: \(credentials)")
        case .failure(let error):
            print("Failed with \(error)")
        }
    }

Hope this helps!