Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngOnInit() {
Auth.currentSession().then(session => {
this.logInfoToConsole(session);
this.session = session;
this.register();
setImmediate(() => this.createUser());
});
this.swUpdate.available.subscribe(event => {
console.log('[App] Update available: current version is', event.current, 'available version is', event.available);
this.update = true;
});
}
getUser = async () => {
try {
const session = await Auth.currentSession();
console.log(session);
} catch (error) {
console.log(error);
}
};
componentDidMount() {
Auth.currentSession()
.then((response) => {
this.setApplicationUser(response);
})
.catch((error) => {
//console.error(error)
});
}
async componentDidMount() {
try {
if (await Auth.currentSession()) {
this.userHasAuthenticated(true);
}
}
catch(e) {
if (e !== 'No current user') {
alert(e);
}
}
this.setState({ isAuthenticating: false });
}
custom_header: async () => {
return { Authorization: (await Auth.currentSession()).idToken.jwtToken };
}
}
jwtToken: async () => (await Auth.currentSession()).getAccessToken().getJwtToken(),
},
jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
},