0
私のアンドロイドアプリケーションとuber apiを統合しています。 auth 2.0の場合、uberからの承認が成功した後、リダイレクトするリターンURLをアプリに入力する必要があります。ここに私のuberですLoginActivityUber apiでauth 2.0後にURLを私のアプリにリダイレクト
WebView webView = (WebView) findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient());
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webView.setScrollbarFadingEnabled(false);
progressBar = ProgressDialog.show(UberLoginActivity.this, "Please wait", "Loading...");
webView.loadUrl("https://login.uber.com/oauth/v2/authorize?client_id=MDyPSkkFFSZHKcntIg9j2mhM7XP665R1&response_type=code");
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId("***********") //This is necessary
.setRedirectUri("what should be added ") //This is necessary if you'll be using implicit grant
.setServerToken("*********************")
.setEnvironment(SessionConfiguration.Environment.SANDBOX) //Useful for testing your app in the sandbox environment
.setScopes(Arrays.asList(Scope.PROFILE, Scope.RIDE_WIDGETS)) //Your scopes for authentication here
.build();
webView.setWebViewClient(new WebViewClient()
{
public void onPageFinished(WebView view, String url)
{
if (progressBar.isShowing())
{
progressBar.dismiss();
}
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl)
{
view.loadUrl("about:blank");
Toast.makeText(getApplication(), " Please check network connectivity", Toast.LENGTH_LONG).show();
super.onReceivedError(view, errorCode, description, failingUrl);
}
});
しかし、私はエラーを取得しています - 無効な認証2.0資格情報..! – gStephin
uberウィジェットを使用していません。私はuberクライアントライブラリの統合を使用しています。私はリダイレクトuriのフォーマットが必要です – gStephin
クライアントライブラリを使用すると、sso loginを実装することができます。これはユーザにとってより良いエクスペリエンスです。それ以外の場合は、正しい方法でoauthリクエストをフォーマットしてください:https://developer.uber.com/docs/ride-requests/guides/authentication/introduction#oauth-20 –