从 Android 客户端使用时,我应该(而不是如何)在 WebApi 中启用 CORS
Should (not How) I enable CORS in WebApi when using from Android client
我有 Android 客户端尝试使用 Asp.Net WebApi2 获取身份验证令牌。每次我发出获取令牌的请求时,我都会收到 {error: unsupported_grant_type}。我的问题是这是否与我的 WebAPI 项目中启用 CORS 有某种关系?
与 CORS 无关。
您是否检查过请求的 ContentType 是 application/x-www-form-urlencoded
并将正文中的数据传递为:
grant_type=password&username=bob&password=password123
我有 Android 客户端尝试使用 Asp.Net WebApi2 获取身份验证令牌。每次我发出获取令牌的请求时,我都会收到 {error: unsupported_grant_type}。我的问题是这是否与我的 WebAPI 项目中启用 CORS 有某种关系?
与 CORS 无关。
您是否检查过请求的 ContentType 是 application/x-www-form-urlencoded
并将正文中的数据传递为:
grant_type=password&username=bob&password=password123