-
This commit is contained in:
@ -62,8 +62,15 @@ const TokenTesterCallback: React.FC = () => {
|
||||
|
||||
// Parse URL parameters
|
||||
const urlParams = new URLSearchParams(location.search);
|
||||
let token = urlParams.get('token') || undefined;
|
||||
|
||||
// If no token in URL, try to extract from auth_token cookie
|
||||
if (!token) {
|
||||
token = getCookie('auth_token') || undefined;
|
||||
}
|
||||
|
||||
const data: CallbackData = {
|
||||
token: urlParams.get('token') || undefined,
|
||||
token: token,
|
||||
state: urlParams.get('state') || undefined,
|
||||
error: urlParams.get('error') || undefined,
|
||||
error_description: urlParams.get('error_description') || undefined,
|
||||
@ -84,6 +91,17 @@ const TokenTesterCallback: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// Utility function to get cookie value by name
|
||||
const getCookie = (name: string): string | null => {
|
||||
const value = `; ${document.cookie}`;
|
||||
const parts = value.split(`; ${name}=`);
|
||||
if (parts.length === 2) {
|
||||
const cookieValue = parts.pop()?.split(';').shift();
|
||||
return cookieValue || null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const verifyToken = async (token: string) => {
|
||||
try {
|
||||
// We need to extract app_id from the state or make a best guess
|
||||
|
||||
Reference in New Issue
Block a user