此刻,我正在尝试使用R中的Google Cloud Vision API使用图像识别。它可以工作到授权为止,但这是我得到的错误:
> c <- fromJSON(file.choose())
> options("googleAuthR.client_id" = c$installed$client_id)
> options("googleAuthR.client_secret" = c$installed$client_secret)
> options("googleAuthR.scopes.selected" =
+ c("https://www.googleapis.com/auth/cloud-platform"))
> googleAuthR::gar_auth()
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in oauth2.0_access_token(endpoint, app, code = code, user_params = user_params, :
Unauthorized (HTTP 401). Failed to get an access token.
>
>Label Detection
>
>
> p <- getGoogleVisionResponse(file.choose(),
+ feature = "LABEL_DETECTION")
2019-02-27 12:24:43> No authorization yet in this session!
2019-02-27 12:24:43> NOTE: a .httr-oauth file exists in current working directory.
Run authentication function to use the credentials cached for this session.
Error: Invalid token
有人知道可能出什么问题吗?在云控制台中,我激活了Google Vision API。