Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Property 'authTokens' does not exist on type 'AuthContextProps'. #17

Open
tyteen4a03 opened this issue Aug 8, 2021 · 3 comments
Open

Comments

@tyteen4a03
Copy link

The example references this:

  const { authService, authTokens } = useAuth();

but authTokens doesn't exist on the object returned by useAuth.

@Goethe0
Copy link

Goethe0 commented Aug 22, 2021

yeah, I changed the code to const authTokens = authService.getAuthTokens() and authTokens.idTokens to authTokens.id_token, but still didn't work, the example didn't even load.

@altenfreelance
Copy link
Contributor

The example is out of date it seems. @Goethe0 comment above resolved the issue for me.

`
const { authService } = useAuth()
const [authTokens, setAuthTokens] = useState(null)

useEffect(() => {
console.log(authTokens)
if (authService.isAuthenticated()) {
setAuthTokens(authService.getAuthTokens())
}
}, [authService.isAuthenticated()])
`

@gardner
Copy link
Owner

gardner commented Sep 13, 2021

I'll have a look at the example. It hasn't been been updated in a while.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants