无法生成 Uber oauth Token UnauthorizedException
Failure to generate Uber oauth Token UnauthorizedException
我正在使用 oauth2-essentials 库,因为它是 uber 开发者网站上推荐的 oauth 库之一,并且最近已更新。
我的代码如下所示:
executor = new HttpUrlConnectionExecutor();
OAuth2AuthorizationProvider provider = new BasicOAuth2AuthorizationProvider(
URI.create("https://login.uber.com/oauth/v2/authorize"),
URI.create("https://login.uber.com/oauth/v2/token"),
new Duration(1,0,3600) /* default expiration time in case the server doesn't return any */);
OAuth2ClientCredentials credentials = new BasicOAuth2ClientCredentials(
getString(R.string.uberClientId), getString(R.string.uberSecret));
uberOAuthClient = new BasicOAuth2Client(
provider,
credentials,
new LazyUri(new Precoded("my redirect url")) /* Redirect URL */);
generateUberOAuthToken("my phone number", "my password");
}
public void generateUberOAuthToken(final String uName, final String password){
new Thread() {
public void run() {
try {
uberOAuthToken = new ResourceOwnerPasswordGrant(
uberOAuthClient, new BasicScope("profile"), uName, password).accessToken(executor);
}
catch (Exception e){
e.printStackTrace();
}
}
}.start();
}
异常:org.dmfs.httpessentials.exceptions.UnauthorizedException:“https://login.uber.com/oauth/v2/token”的身份验证失败。总是被抛出。我试过删除重定向 url 所以它应该使用我的仪表板中的默认设置,并且我试过向 phone 数字添加 1 and/or 破折号。当我请求访问令牌时,总是抛出异常。我知道我的帐户设置正确,因为这在 iOS 中工作正常。我觉得我一定错过了一些明显的东西。还有其他人 运行 关注这个问题吗?
令牌 api 无法将我的 phone 号码识别为有效的登录参数。当我改用我的电子邮件时它起作用了。
我正在使用 oauth2-essentials 库,因为它是 uber 开发者网站上推荐的 oauth 库之一,并且最近已更新。 我的代码如下所示:
executor = new HttpUrlConnectionExecutor();
OAuth2AuthorizationProvider provider = new BasicOAuth2AuthorizationProvider(
URI.create("https://login.uber.com/oauth/v2/authorize"),
URI.create("https://login.uber.com/oauth/v2/token"),
new Duration(1,0,3600) /* default expiration time in case the server doesn't return any */);
OAuth2ClientCredentials credentials = new BasicOAuth2ClientCredentials(
getString(R.string.uberClientId), getString(R.string.uberSecret));
uberOAuthClient = new BasicOAuth2Client(
provider,
credentials,
new LazyUri(new Precoded("my redirect url")) /* Redirect URL */);
generateUberOAuthToken("my phone number", "my password");
}
public void generateUberOAuthToken(final String uName, final String password){
new Thread() {
public void run() {
try {
uberOAuthToken = new ResourceOwnerPasswordGrant(
uberOAuthClient, new BasicScope("profile"), uName, password).accessToken(executor);
}
catch (Exception e){
e.printStackTrace();
}
}
}.start();
}
异常:org.dmfs.httpessentials.exceptions.UnauthorizedException:“https://login.uber.com/oauth/v2/token”的身份验证失败。总是被抛出。我试过删除重定向 url 所以它应该使用我的仪表板中的默认设置,并且我试过向 phone 数字添加 1 and/or 破折号。当我请求访问令牌时,总是抛出异常。我知道我的帐户设置正确,因为这在 iOS 中工作正常。我觉得我一定错过了一些明显的东西。还有其他人 运行 关注这个问题吗?
令牌 api 无法将我的 phone 号码识别为有效的登录参数。当我改用我的电子邮件时它起作用了。