question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request: document best practices for authentication

See original GitHub issue

Almost every app needs authentication, so it would be useful to document recommended patterns.

For example, below I have a user state which indicates whether the user is logged in or not.

Based on that state the app should navigate to either the welcome scene or the tabs scene.

I’ve tried implementing this behaviour with a useEffect, but it’s not firing.

const navigator = new StateNavigator([
	{ key: 'welcome' },
	{ key: 'tabs' }
])

const { welcome, tabs } = navigator.states

welcome.renderScene = () => <Welcome/>
tabs.renderScene = () => <Tabs/>

const Navigation = () => {

const { user } = useUser()

useEffect(() => {
	user ? navigator.navigate('tabs') : navigator.navigate('home')
}, [user, navigator])

return(
<NavigationHandler stateNavigator={navigator}>
  <NavigationStack />
</NavigationHandler>)
}

Is there a recommended way of doing this I’m missing?

Any insight is greatly appreciated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
grahammendickcommented, Jan 28, 2022

No bother, I’m just glad you got it working. You happy to close this?

0reactions
vbylencommented, Jan 28, 2022

No luck.

Putting // @refresh reset in the Navigation.js file fixed it.

Thanks for holding my hand.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identity Authentication Best Practices
The authentication methods discussed in this guidance document are intended to serve as examples of best practices, and the provided list of methods...
Read more >
6 Authentication Best Practices
1. Prioritize passwordless authentication · 2. Implement federated login and single sign-on (SSO) · 3. Harden authentication functionality · 4.
Read more >
Best practices for REST API security: Authentication and ...
Best practices for REST API security: Authentication and authorization · Always use TLS · Use OAuth2 for single sign on (SSO) with OpenID...
Read more >
Authentication — Requests 2.28.1 documentation
This document discusses using various kinds of authentication with Requests. Many web services require authentication, and there are many different types.
Read more >
Account authentication and password management best ...
13 best practices for user account, authentication, and password management · 1. Hash those passwords · 2. Allow for third-party identity ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found