xxxxxxxxxx
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-89.156006,
14.838634
]
},
"properties": {
"id": "59",
"name": "Departamento",
"address": "Copán Ruinas, Copán, Honduras",
"zoom": "10.0",
"icon": "https://portal.rds.hn/wp-content/plugins/maps-marker-pro/images/leaflet/marker.png",
"popup": "<table style="border-collapse: collapse;width: 581pt" width="774"> <tbody> <tr style="height: 30.0pt"> <td class="xl23" style="width: 581pt;height: 30.0pt" width="774" height="40">Proyecto Aporto</td> </tr> </tbody> </table> ",
"link": "",
"maps": [
"20"
]
}
}
]
}
]
},
"properties": {
"id": "59",
"name": "Departamento",
"address": "Olancho, Juticalpa, Honduras",
"zoom": "10.0",
"icon": "https://portal.rds.hn/wp-content/plugins/maps-marker-pro/images/leaflet/marker.png",
"popup": "<table style="border-collapse: collapse;width: 581pt" width="774"> <tbody> <tr style="height: 30.0pt"> <td class="xl23" style="width: 581pt;height: 30.0pt" width="774" height="40">Proyecto Aporto</td> </tr> </tbody> </table> ",
"link": "",
"maps": [
"20"
]
}
}
]
}
xxxxxxxxxx
export const refreshAccessToken = async (refreshToken: string) => {
console.log('refreshAccessToken function invoked: \n \n')
try {
const response = await axios.post(
`https://${process.env.AUTH0_DOMAIN}/oauth/token`,
{
grant_type: 'refresh_token',
client_id: process.env.AUTH0_CLIENT_ID,
client_secret: process.env.AUTH0_CLIENT_SECRET,
refresh_token: refreshToken,
},
{
headers: {
'Content-Type': 'application/json',
},
}
)
const { id_token, refresh_token, expires_in } = response.data
console.log('NEW Accesstoken: \n \n', id_token)
return {
accessToken: id_token,
accessTokenExpires: Date.now() + expires_in * 1000, // this recalculates expiration time
refreshToken: refresh_token,
}
} catch (error: any) {
console.error('Error refreshing access token:', error.response?.data || error.message)
return null // Return null if there’s an error
}
}