Log Out a User's Magic Session
Sometimes you will find yourself needing to log your users out from the server-side. This provides a small example of how to do so.
0. Prerequisite: Install Magic Admin SDKโ
1. Invalidate the user session:
- With public address
- With DID Token
app.post('/logout', (req: any, res: any) => {
const userPublicAddress = magicAdmin.token.getPublicAddress(
req.headers.authorization
);
magicAdmin.users.logoutByPublicAddress(userPublicAddress);
});