Wraps Stytch's revoke Session endpoint and revokes the user's current session. This method should be used to log out a user. While calling this method, we clear the user and session objects from local storage unless the SDK cannot contact the Stytch servers. This behavior can be overriden by using the optional param object.
Revoke session
Response fields
request_id string
status_code int
import React, { useCallback } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import { useStytchB2BClient } from '@stytch/react-native/b2b';
export const LogOutButton = () => {
const stytch = useStytchB2BClient();
const logout = useCallback(() => {
stytch.session.revoke();
}, [stytch]);
return (
<View>
<TouchableOpacity onPress={logout}>
<Text>Log out</Text>
</TouchableOpacity>
</View>
);
};
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141"
}