vinayak
$fetch not working
try {
const url = `${BASE_URL}/SSORESTNEW/TokenDetail`;
const options = {
method: 'GET',
headers: {
'Authorization': `Basic ${Buffer.from(`${ssoDefaultUsername}:${ssoDefaultPassword}`).toString('base64')}`,
'content-type': 'application/json',
'SSO-TOKEN': token,
},
};
const response = await fetch(url, options);
const data: TokenDetailResponse = await response.json();
console.log('[getTokenDetail] Response:', data);
return data;
} catch (error) {
console.error('Error fetching token details:', error);
throw error;
}
try {
const url = `${BASE_URL}/SSORESTNEW/TokenDetail`;
const options = {
method: 'GET',
headers: {
'Authorization': `Basic ${Buffer.from(`${ssoDefaultUsername}:${ssoDefaultPassword}`).toString('base64')}`,
'content-type': 'application/json',
'SSO-TOKEN': token,
},
};
const response = await fetch(url, options);
const data: TokenDetailResponse = await response.json();
console.log('[getTokenDetail] Response:', data);
return data;
} catch (error) {
console.error('Error fetching token details:', error);
throw error;
}
try {
const data = await $fetch<TokenDetailResponse>(`${BASE_URL}/SSORESTNEW/TokenDetail`, {
method: 'GET',
headers: {
'Authorization': `Basic ${Buffer.from(`${ssoDefaultUsername}:${ssoDefaultPassword}`).toString('base64')}`,
'content-type': 'application/json',
'SSO-TOKEN': token,
},
});
return data;
} catch (error) {
console.error('Error fetching token details:', error);
throw error;
}
try {
const data = await $fetch<TokenDetailResponse>(`${BASE_URL}/SSORESTNEW/TokenDetail`, {
method: 'GET',
headers: {
'Authorization': `Basic ${Buffer.from(`${ssoDefaultUsername}:${ssoDefaultPassword}`).toString('base64')}`,
'content-type': 'application/json',
'SSO-TOKEN': token,
},
});
return data;
} catch (error) {
console.error('Error fetching token details:', error);
throw error;
}
'Authorization': `Basic ${btoa(`${ssoDefaultUsername}:${ssoDefaultPassword}`)}`,
'Authorization': `Basic ${btoa(`${ssoDefaultUsername}:${ssoDefaultPassword}`)}`,
3 replies