gpt4 book ai didi

android - 嵌入式 Web 浏览器上的 Azure Oauth 身份验证将于 2017 年 4 月 20 日被阻止,发出警告

转载 作者:行者123 更新时间:2023-11-29 02:41:43 25 4
gpt4 key购买 nike

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mobileprogramming.sampleappforcnac">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
tools:replace="android:icon"
android:theme="@style/AppTheme">

<activity android:name="com.mobileprogramming.sampleappforcnac.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


<activity android:name="com.microsoft.windowsazure.mobileservices.authentication.RedirectUrlActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="cnacs://easyauth.callback"
android:host="easyauth.callback"/>
</intent-filter>
</activity>


<activity android:name="com.microsoft.windowsazure.mobileservices.authentication.CustomTabsIntermediateActivity" android:exported="false" />
<activity android:name="com.microsoft.windowsazure.mobileservices.authentication.CustomTabsLoginActivity" android:exported="false" android:launchMode="singleTask" />

</application>



</manifest>
<小时/>
package com.mobileprogramming.sampleappforcnac;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.microsoft.windowsazure.mobileservices.MobileServiceActivityResult;
import com.microsoft.windowsazure.mobileservices.MobileServiceClient;
import com.microsoft.windowsazure.mobileservices.authentication.MobileServiceAuthenticationProvider;
import com.microsoft.windowsazure.mobileservices.authentication.MobileServiceUser;

import java.net.MalformedURLException;

public class MainActivity extends Activity {

public static final int GOOGLE_LOGIN_REQUEST_CODE = 1;
private MobileServiceClient mClient;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
mClient = new MobileServiceClient("https://cnacs.azurewebsites.net", this);
} catch (MalformedURLException e) {
e.printStackTrace();
}

Button aadLoginButton = (Button) findViewById(R.id.googleLogin);
aadLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mClient.login("Google", "cnacs://easyauth.callback", GOOGLE_LOGIN_REQUEST_CODE);

}
});

try {

// mClient = new MobileServiceClient("https://cnacs.azurewebsites.net", this);

} catch (Exception e) {

e.printStackTrace();
}


}


private void authenticate() {

ListenableFuture<MobileServiceUser> mLogin = mClient.login(MobileServiceAuthenticationProvider.Google);

Futures.addCallback(mLogin, new FutureCallback<MobileServiceUser>() {
@Override
public void onFailure(Throwable exc) {
Toast.makeText(MainActivity.this, "You must log in. Login Required", Toast.LENGTH_LONG).show();
}

@Override
public void onSuccess(MobileServiceUser user) {
Toast.makeText(MainActivity.this, "You must log in. Login Required", Toast.LENGTH_LONG).show();

}
});

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// When request completes
if (resultCode == RESULT_OK) {
// Check the request code matches the one we send in the login request
if (requestCode == GOOGLE_LOGIN_REQUEST_CODE) {
MobileServiceActivityResult result = mClient.onActivityResult(data);
if (result.isLoggedIn()) {
Toast.makeText(this, "logedin", Toast.LENGTH_SHORT).show();
// login succeeded
// createAndShowDialog(String.format("You are now logged in - %1$2s", mClient.getCurrentUser().getUserId()), "Success");
// createTable();
} else {
Toast.makeText(this, "failed", Toast.LENGTH_SHORT).show();
// login failed, check the error message
String errorMessage = result.getErrorMessage();
// createAndShowDialog(errorMessage, "Error");
}
}
}
}


}

我正在关注 azure 的以下文档

https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-android-get-started-users

我尝试过以两种方式更改回调答:

mClient.login("Google", "cnacs://easyauth.callback", GOOGLE_LOGIN_REQUEST_CODE);

b:

 mClient.login("Google", "cnacs", GOOGLE_LOGIN_REQUEST_CODE);

也在 list 中我尝试了两种方式 答:

<data android:scheme="cnacs://easyauth.callback"
android:host="easyauth.callback"/>

b:

 <data android:scheme="cnacs"
android:host="easyauth.callback"/>

我已经尝试了两种方式,但我在 onActivityResult 中获取的用户数据为空,即使 webView 说“登录成功”。请让我知道我应该做什么以及我在哪里做错了。 在此处输入代码

最佳答案

为了结束这个问题(并供将来引用),这个问题正在 GitHub 上讨论。并将在那里得到答复。

关于android - 嵌入式 Web 浏览器上的 Azure Oauth 身份验证将于 2017 年 4 月 20 日被阻止,发出警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43594573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com