20 lines
606 B
TypeScript
20 lines
606 B
TypeScript
import db from "../db"
|
|
|
|
export const resetAccessToken = async () => {
|
|
const URL = 'https://open.f.mioffice.cn/open-apis/auth/v3/tenant_access_token/internal'
|
|
const app_id = 'cli_a1eff35b43b89063'
|
|
const app_secret = 'IFSl8ig5DMwMnFjwPiljCfoEWlgRwDxW'
|
|
const res = await fetch(URL, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
app_id,
|
|
app_secret
|
|
})
|
|
})
|
|
const { tenant_access_token } = await res.json() as any
|
|
await db.tenantAccessToken.update(tenant_access_token)
|
|
return tenant_access_token
|
|
} |