function RedirectFunction(url:string,authorization:string){
  const result =  fetch(url, {
    method: 'POST',
    headers:{
      "Content-Type":"application/x-www-form-urlencoded",
      "Authorization":authorization, 
    },
    body: 'grant_type=client_credentials',
  })
    .then(async (response) => {
     const responseData = await response.json();
      return responseData.access_token;
    })
    .catch((error) => {
      return 'Viva Wallet Authorization Error';
    });
    return result;
}

export { RedirectFunction };