TypeScript错误TS2339:类型“用户”上不存在属性“ id”

时间:2020-01-24 12:54:51

标签: node.js typescript

TS的新手,这里的第一个问题。请帮助我理解为什么我收到以下错误以及如何解决该错误:

类型“用户”上不存在属性“ id”

我已经在网络上进行了广泛搜索,因此无济于事。

public void Configuration(IAppBuilder app)
    {
        app.UseCors(CorsOptions.AllowAll);
        //app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

        OAuthAuthorizationServerOptions option = new OAuthAuthorizationServerOptions
        {
            TokenEndpointPath = new PathString("/token"),
            Provider = new ApplicationOAuthProvider(),
            AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(300),
            AllowInsecureHttp = true
        };
        app.UseOAuthAuthorizationServer(option);
        app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());

    }

public void ConfigureServices(IServiceCollection services)
    {
        services.AddAuthentication(IISDefaults.AuthenticationScheme);
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

public void Configure(IApplicationBuilder app)
    {
        app.UseAuthentication();
    }

1 个答案:

答案 0 :(得分:-1)

尝试将正文添加到要求:

req.body.user.id