在虚拟 windows 上使用 google-cloud-vision api 时出现无效的 JWT 错误
invalid JWT error with timeframe using google-cloud-vision api on virtual windows
我在 virtualbox 上安装了 windows7,以便在我的 CentOS 服务器上的 activeX 网页上使用 google-cloud-vision api。
使用google-cloud-vision API进行认证,认证过程中出现如下错误:
google.api_core.exceptions.ServiceUnavailable: 503 Getting metadata from plugin failed with error: ('invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.')
Windows Internet Time Sync,时间同步,但出现错误。
但正常 Windows 上的代码相同,不会发生错误。
client = vision.ImageAnnotatorClient()
imgByteArr = io.BytesIO()
textImage.save(imgByteArr, format='PNG')
content = imgByteArr.getvalue()
image = types.Image(content=content)
response = client.text_detection(image=image)
labels = response.text_annotations
print(labels[0].description)
故障排除:重置 host os 时间(设置 NTP)
问题是 host os 和客人 os 之间的时间差。
ln -sf / usr / share / zoneinfo / Asia / Seoul / etc / localtime
rdate -s time.bora.net
hwclock --systohc
date
hwclock
在 time.bora.net
,找到并配置适当的 ntp(网络时间协议)服务器。适合您的地区
我在 virtualbox 上安装了 windows7,以便在我的 CentOS 服务器上的 activeX 网页上使用 google-cloud-vision api。
使用google-cloud-vision API进行认证,认证过程中出现如下错误:
google.api_core.exceptions.ServiceUnavailable: 503 Getting metadata from plugin failed with error: ('invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.')
Windows Internet Time Sync,时间同步,但出现错误。 但正常 Windows 上的代码相同,不会发生错误。
client = vision.ImageAnnotatorClient()
imgByteArr = io.BytesIO()
textImage.save(imgByteArr, format='PNG')
content = imgByteArr.getvalue()
image = types.Image(content=content)
response = client.text_detection(image=image)
labels = response.text_annotations
print(labels[0].description)
故障排除:重置 host os 时间(设置 NTP)
问题是 host os 和客人 os 之间的时间差。
ln -sf / usr / share / zoneinfo / Asia / Seoul / etc / localtime
rdate -s time.bora.net
hwclock --systohc
date
hwclock
在 time.bora.net
,找到并配置适当的 ntp(网络时间协议)服务器。适合您的地区