/auth
Search
K
Comment on page

logout

This function is used to logout users from the app.

Usage

import React from 'react';
import { useSlashAuth } from '@slashauth/slashauth-react';
export const Logout = () => {
const { logout } = useSlashAuth();
return <button onClick={() => logout()}>Logout</button>;
};

Return Value

void

Configuration

localOnly (optional)

When true, this skips the request to the logout endpoint on the authorization server, effectively performing a "local" logout of the application. No redirect should take place, you should update local logged in state.
import React from 'react';
import { useSlashAuth } from '@slashauth/slashauth-react';
export const Logout = () => {
const { logout } = useSlashAuth();
return <button onClick={() => logout({ localOnly: true })}>Logout</button>;
};