Enable CORS for the API
This commit is contained in:
parent
d416f39b36
commit
e0a93ba608
@ -6,6 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
@ -30,6 +30,7 @@ namespace PluralKit.API
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCors();
|
||||
services.AddMvc(opts => { })
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
|
||||
.AddJsonOptions(opts => { opts.SerializerSettings.BuildSerializerSettings(); });
|
||||
@ -60,6 +61,7 @@ namespace PluralKit.API
|
||||
}
|
||||
|
||||
//app.UseHttpsRedirection();
|
||||
app.UseCors(opts => opts.AllowAnyMethod().AllowAnyOrigin());
|
||||
app.UseMiddleware<TokenAuthService>();
|
||||
app.UseMvc();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user