我使用改装打造的Android应用程序Github上,但我从https://api.github.com/authorizations改造-u用户名:密码字段和范围阵列
我知道如何用命令卷曲的要求去做有麻烦检索令牌:
curl -X POST -H "Accept: Application/json" -u "username:password" -d '{"scopes": ["user","repo","gist","notifications","repo","repo:status"],"note":"GithubViewer Android App","client_id":"xxx","client_secret":"yyyy"}' "https://api.github.com/authorizations"
我遇到了麻烦,知道如何设置Scopes数组和-u认证字段。我一直在使用“:基本用户名:密码验证”在命令行中尝试,但不工作,要么:(
这里是什么,我试图做一个样本:
RequestInterceptor interceptor = new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader("Authentication", "Basic " + username + ":" + password);
}
};
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(GithubClient.API_URL)
.setRequestInterceptor(interceptor)
.build();
任何建议?
谢谢
你可以发布你做了什么吗? – Atieh 2015-02-02 00:14:42
这就是我所做的。首先,我修改了我的请求,以发送带请求的@Body。我创建了一个可以序列化为该请求所需的类的类。 https://gist.github.com/fnk0/f3ef3d5d15d72bff3fb2 – 2015-02-02 19:57:19
我想通了昨天该怎么做。我错过了那里的@Body注释,不得不创建一个基本的认证。谢谢!你完成了你的应用程序?我可以查看它8D – Atieh 2015-02-02 20:12:37