Which render function to use?


#1

Hello,

These three functions of the signin widget feel so similar I don’t understand the difference.

I have a single HTML/JavaScript page, served by a node webserver. I want visitors to hit the page with the following or similar logic flow.
“If not signed in, render the widget, else render the HTML.”

I seem to have what I am hoping for already working using sample code from the documentation, however I don’t feel confident I am using the right approach given the three possibilities below. I have seen sample code using both the renderEL and token.hasTokensInUrl and am not sure which route to take and why.

renderEl

Renders the widget to the DOM, and passes control back to your app through success and error callback functions when the user has entered a success or error state.

showSignInToGetTokens

Renders the widget to the DOM to prompt the user to sign in. On successful authentication, users are redirected back to the application via the redirectUri with an Okta SSO session in the browser, and access and/or identity tokens in the fragment identifier.

token.hasTokensInUrl

Synchronous method to check for access or ID Tokens in the url. This is used when authParams.display = 'page' . Returns true if there are tokens, and false if the redirect flow has not taken place yet.

All 3 of these feel so similar…


#2

Hi @ajhstn

To achieve “if not signed in, render the widget, else render the HTML”, you can use the example provided here.


#3

Hey mate, given that I have clearly copy/pasted directly from that page already to identify 3 functions that I ask clarification on, and so I didn’t find your reply that helpful.

Can I please ask what are the differences or questions to ask when choosing how to render the login widget and why I may choose one of the three possibles above.


#4

@nate.barbettini Can you assist @ajhstn with the query above?