0
uber api를 내 Android 애플리케이션과 통합합니다. auth 2.0의 경우 uber의 성공적인 승인 후에 내 앱으로 들어가기 위해 리다이렉트 (return) URL을 어떻게해야합니까? 여기 내 uber입니다 로그인 활동Uber api에서 인증 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 클라이언트 라이브러리 통합을 사용합니다. 리디렉션 uri 형식이 필요합니다. – gStephin
클라이언트 라이브러리를 사용하면 sso login을 구현할 수 있습니다. 이는 사용자에게 더 나은 환경입니다. 그렇지 않으면 oauth 요청의 형식을 지정하는 올바른 방법 (https://developer.uber.com/docs/ride-requests/guides/authentication/introduction#oauth-20)을 참조하십시오. –