将令牌添加到Android Vimeo API的标头中 [英] Add token to the header of Vimeo API Android

查看:116
本文介绍了将令牌添加到Android Vimeo API的标头中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,对不起我的英语,谢谢,如果您编辑我的问题. 我需要使用管理员帐户来访问我的应用中的视频. 文档说,所以我必须在标头上发送令牌:

First of all, sorry for my english, thanks if you edit my question. I need to use my admin account to access for videos on my app. So i must send my token on the header, the docs said:

curl -H授权:承载OAUTH_TOKEN" https://api.vimeo.com

但是我无法在Java上执行此操作,这是我的方法:

But i cant do this on Java, this is my method:

公共调用fetchContent(String uri,CacheControl cacheControl,ModelCallback回调, @Nullable字符串查询,@ Nullable地图finementMap, @Nullable字符串fieldFilter)

public Call fetchContent(String uri, CacheControl cacheControl, ModelCallback callback, @Nullable String query, @Nullable Map refinementMap, @Nullable String fieldFilter)

推荐答案

您可以使用版本1.0.1 .如果您参考自述文件以及VimeoClient实例:开发者控制台.

You can do this with version 1.0.1 of the vimeo-networking library. If you refer to the new section in the README as well as the sample app, it will cover how to initialize the VimeoClient instance with an oAuth Token (or "access token") provided by the developer console.

VimeoClient.initialize(new Configuration.Builder(<accessToken>).build());

如果您还希望允许代码授权身份验证,则可以使用客户机ID和客户机密钥来交替初始化构建器,然后使用setAccessToken(<accessToken>)在构建器上设置访问令牌.

You can alternately initialize the builder with the client id and client secret and then set the access token on the builder with setAccessToken(<accessToken>) if you want to also allow for code grant authentication.

在构建器上设置此访问令牌将默认所有使用该令牌的请求.如果您提供了客户端ID和客户端密钥,则您的应用程序用户可以使用代码授权身份验证进行身份验证.这将覆盖您最初提供的访问令牌",以后所有的请求都将使用其令牌.

Setting this access token on the builder will default all requests to use that token. If you've provide the client id and client secret, then users of your app could authenticate with a code grant authentication. This will overwrite your initially provided "access token" and all future requests will use their token.

全面披露:我是该图书馆的作者之一.我们也强烈建议在此处提出任何问题或功能请求.

Full disclosure: I'm one of the authors of this library. We also highly encourage any issues or feature requests to be filed here.

这篇关于将令牌添加到Android Vimeo API的标头中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆