我想在我的应用程序中使用 google api。
我成功获得了访问令牌,但出现错误:-
“缺少令牌端点 URI。”
我的代码是
def calender
client = Signet::OAuth2::Client.new(access_token: session[:access_token])
drive = Google::Apis::DriveV3::DriveService.new
drive.authorization = client
files = drive.list_files
end
Run Code Online (Sandbox Code Playgroud)
当我打印客户端变量时,它显示了我的这些详细信息
#<Google::Apis::DriveV3::DriveService:0x0000010cc287f8
@root_url="https://www.googleapis.com/",
@base_path="drive/v3/",
@upload_path="upload/drive/v3/",
@batch_path="batch",
@client_options=#<struct Google::Apis::ClientOptions application_name="unknown", application_version="0.0.0", proxy_url=nil, use_net_http=false>,
@request_options=#<struct Google::Apis::RequestOptions
authorization=#<Signet::OAuth2::Client:0x0000010cc288c0
@authorization_uri=nil,
@token_credential_uri=nil,
@client_id=nil,
@client_secret=nil,
@code=nil,
@expires_at=nil,
@expires_in=nil,
@issued_at=nil,
@issuer=nil,
@password=nil,
@principal=nil,
@redirect_uri=nil,
@scope=nil,
@state=nil,
@username=nil,
@expiry=60,
@extension_parameters={},
@additional_parameters={},
@access_token="ya29.CjAbA8B7CFyhBLhFuEtP6kmCmuvJESwClkchiPpydjAqBOvDuvDERVCSVrYSSWLZvZc">, retries=0,
header=nil,
timeout_sec=nil,
open_timeout_sec=20>
Run Code Online (Sandbox Code Playgroud)
我花了两天时间来解决这个问题并探索了整个互联网,但我的问题没有解决。我的问题与已报告的问题有关:- 使用有效的 access_token 时缺少令牌端点 URI 但其中提供的解决方案也不适用于我。没有可用于分配令牌的“身份验证”属性。
如果有人帮助我,我将不胜感激。