我是春季靴子休息服务的新手。我使用 maven 项目在 spring boot 中开发了一些 rest api。
我已经成功开发了 Get 和 Post Api。我的 GET 方法在邮递员和移动设备中正常工作。 当我试图从邮递员中使用 post 方法时,它可以正常工作,但从移动端使用它会出现 403 禁止错误。
这是我的配置:
spring.datasource.url = jdbc:mysql://localhost/sampledb?useSSL=false
spring.datasource.username = te
spring.datasource.password = test
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
请建议我如何解决错误。
原文由 Harshal Deshmukh 发布,翻译遵循 CC BY-SA 4.0 许可协议
您必须禁用 csrf 保护,因为它在 spring security 中默认启用:在这里您可以看到允许 cors 来源的代码。