我有一个现有的通用应用程序。试图实施Facebook登录。
我将Windows应用程序添加到Facebook应用程序并在那里粘贴了来自Windows应用商店的应用程序SID(ms-app:// s-1-15-2 -...没有ms-app://的东西) whole of the project is on GitHub
这是获取auth url的代码
public class LoginActivity extends ActionBarActivity {
// The string will appear to the user in the login screen
// you can put your app's name
final String REALM_PARAM = "YourAppName";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final WebView webView = new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
final Activity activity = this;
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url,
Bitmap favicon) {
//checks the url being loaded
setTitle(url);
Uri Url = Uri.parse(url);
if(Url.getAuthority().equals(REALM_PARAM.toLowerCase())){
// That means that authentication is finished and the url contains user's id.
webView.stopLoading();
// Extracts user id.
Uri userAccountUrl = Uri.parse(Url.getQueryParameter("openid.identity"));
String userId = userAccountUrl.getLastPathSegment();
// Do whatever you want with the user's steam id
});
setContentView(webView);
// Constructing openid url request
String url = "https://steamcommunity.com/openid/login?" +
"openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&" +
"openid.identity=http://specs.openid.net/auth/2.0/identifier_select&" +
"openid.mode=checkid_setup&" +
"openid.ns=http://specs.openid.net/auth/2.0&" +
"openid.realm=https://" + REALM_PARAM + "&" +
"openid.return_to=https://" + REALM_PARAM + "/signin/";
webView.loadUrl(url);
}
}
当我打电话
var client = new FacebookClient();
var url = _facebookClient.GetLoginUrl(new
{
client_id = Config.FacebookAppIdCZ ,
redirect_uri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri,
scope = "email,public_profile",
display = "popup",
response_type = "token"
});
在Windows Phone上,auth代理显示Facebook登录UI,并且everzthing工作正常。
但是在Windows上我打电话
WebAuthenticationBroker.AuthenticateAndContinue(url);
Facebook告诉我
var auth = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, url);
我猜这是一个Facebook配置问题,但我被卡住了。我确定App SID是正确的,它在Windows应用商店中是相同的,当我调用Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
时(因为应用已经与商店关联)。
答案 0 :(得分:0)
也许redirect_uri具有从平台到另一个平台的不同价值。
当完整的重定向网址不在字段
时,我在asp上出现此错误有效的OAuth重定向URI (fb app - >设置 - >高级 - > OAuth设置)
您还可以尝试将重定向_url的域添加到App Domains。
另一件事是,你是否尝试过小提琴手看看发送和收到了什么?
PS。原谅我糟糕的英语,我是法国人。
答案 1 :(得分:0)
这是Facebook造成的暂时故障,见https://developers.facebook.com/bugs/1448059258828537/?__mref=message_bubble。如果这样的事情再次发生,请考虑通过使用和方法进行替代登录,如我在此处所述[{3}}