传递凭据不工作 [英] passing credentials not working

查看:96
本文介绍了传递凭据不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个JSON调用,传递的凭据。如果用户已经登录到使用SQL成员资格制度,我怎么能凭据传递没有得到这样的:

I am trying to make a json call, by passing the credentials. If the user is already logged into the system using Sql Membership, how can I pass the credentials without getting this:

下面是code调用web.api:

Here is the code that calls the web.api:

注:呼叫正在从跨域:即www.project.com - > api.project.com

NOTE: call is being made from cross domain: i.e. www.project.com -> api.project.com

var url = 'http://api.project.com/LookUps/uploadtypes?callback=?';

$.ajax({
    type: 'GET',
    url: url,
    async: true,
    xhrFields: {
        withCredentials: true
    },
    jsonpCallback: 'handler',
    contentType: "application/javascript",
    dataType: 'jsonp',
    success: function (json, textStatus, jqxhr) { console.log(jqxhr.responseText); },
    error: function (json, textStatus, jqxhr) { console.log(jqxhr.responseText); }
 });

编辑:

我仍然得到了登录时的身份验证被禁用。是否有另一个地方为窗口的身份验证设置?

I still get the login when authentication is disabled. Is there another place for the window authentication setting?

推荐答案

要prevent这个弹出,你必须将你的URL更改为以下。

To prevent this popup you have to change your URL to following.

VAR URL ='的http://用户名:password@api.project ?.COM /查找/ uploadtypes回调= ';

var url = 'http://username:password@api.project.com/LookUps/uploadtypes?callback=?';

替换用户名 - 与实际的用户名 和密码的实际密码。

replace username - with actual username and password with actual password.

这篇关于传递凭据不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆