OpenTouryoProject / FrontendTemplates

各種フロントエンド用のテンプレートです。このテンプレートを使用してフロントエンド開発プロジェクトを迅速に立ち上げることができます。(These are templates for various front ends. You can use this template to quickly launch front-end development projects.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A request by the implicit flow of SPA_Sample to ASP.NET Core Web API is not accepted.

daisukenishino2 opened this issue · comments

Requirement

Observed the problem that the request from implicit flow of SPA_Sample by jQuery doesn't accepted to the ASP.NET Core Web API. It seems that it is not a problem such as the token of authz header.

Because, I tested as follows for isolate problems to the ASP.NET Core Web API.

  • SPA sent bearer token, then it's request isn't accepted.
  • Sent bearer token from UWP, then it's request is accepted.

Currently, I think there is a possibility that the problem occurred by sent the request from URLs with hash fragments after getting token, or compatibility of jQuery and ASP.NET Core Web API.

There is possibility to resolve in the following.

UseCors

app.UseCors("MyPolicy");

AddCors

   services.AddCors(o => o.AddPolicy("MyPolicy", builder =>
   {
       builder.AllowAnyOrigin()
              .AllowAnyMethod()
              .AllowAnyHeader();
   }));

EnableCors

[EnableCors("MyPolicy")]

Reference

Microsoft Docs

MultiPurposeAuthSite

There is possibility to resolve in the following.

SPA_Sample side problem.

jQuery version is old, etc.

ASP.NET Core Web API side problem.

There is a problem with WebApiCompatShim, etc.

This issue has been resolved.

However, we are working with Private repositories and this fix has not yet been merged.

reference: