I am trying to verify details from a user in the created() method in vuejs. This allows me to determine what component to show the user.
However, using
async created() {
// Get the access token from the auth wrapper
const token = await this.$auth.getTokenSilently();
}
gives me the error of "[Vue warn]: Error in created hook (Promise/async): “TypeError: Cannot read property ‘getTokenSilently’ of null” and “vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property ‘getTokenSilently’ of null”
It works fine when on a button, but surely i need to determine this before the component is loaded?
Any ideas?