# Which render function to use?

**URL:** <https://devforum.okta.com/t/which-render-function-to-use/4445>\
**Category:** Questions\
**Created:** [March 10, 2019, 10:51am UTC](https://devforum.okta.com/t/which-render-function-to-use/4445 "2019-03-10T10:51:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajhstn](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@ajhstn](https://devforum.okta.com/u/ajhstn)\
**Post date:** [March 10, 2019, 10:51am UTC](https://devforum.okta.com/t/which-render-function-to-use/4445/1 "2019-03-10T10:51:55Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [March 11, 2019, 4:40pm UTC](https://devforum.okta.com/t/which-render-function-to-use/4445/2 "2019-03-11T16:40:49Z")

</div>

Hi @ajhstn

To achieve “if not signed in, render the widget, else render the HTML”, you can use the example provided [here](https://github.com/okta/okta-signin-widget#tokenparsetokensfromurl).

---

<div class="post-metadata">

**Author:** ![ajhstn](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@ajhstn](https://devforum.okta.com/u/ajhstn)\
**Post date:** [March 11, 2019, 8:43pm UTC](https://devforum.okta.com/t/which-render-function-to-use/4445/3 "2019-03-11T20:43:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [March 12, 2019, 6:36pm UTC](https://devforum.okta.com/t/which-render-function-to-use/4445/4 "2019-03-12T18:36:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 17, 2024, 11:15pm UTC](https://devforum.okta.com/t/which-render-function-to-use/4445/5 "2024-01-17T23:15:48Z")

</div>

Closed on January 17, 2024, 11:15pm UTC


