测试 Stormpath 时遇到 Expected CSRF token not found 错误
Encountered Expected CSRF token not found error while testing Stormpath
我在这里以 Stormpath 为例:
http://docs.stormpath.com/java/spring-boot-web/http-request-authentication.html
目前为止一切正常。
但是当我尝试发出命令时:
curl -X POST --data 'grant_type=password&username=ACCOUNT_USERNAME&password=ACCOUNT_PASSWORD' \
-H 'Origin: http://localhost:8080' http://localhost:8080/oauth/token
我收到这个错误:
<body>
<div class="container-fluid">
<div class="row">
<div class="box col-md-6 col-md-offset-3">
<div class="stormpath-header">
<img src="https://stormpath.com/images/template/logo-nav.png" />
</div>
<div class="logo">
<h1>403</h1>
</div>
<p class="lead text-muted">Expected CSRF token not found. Has your session expired?</p>
<a href="/" class="btn btn-primary">Go Home</a>
</div>
</div>
</div>
</body>
关于如何解决这个问题的任何线索?
您使用的是哪个 Stormpath Spring Boot Starter?
stormpath-default-spring-boot-starter
(和其他)包括 Spring 安全。
目前,Spring 安全和 /oauth/token
与 Stormpath 集成不兼容。
好消息!我们这周真的发布了新的令牌管理集成。即将发布1.0.RC8.3
。您可以跟踪它的状态 here。它通过 Spring 堆栈完美集成,包括 Spring 安全性。它还提供访问和刷新令牌,并支持用刷新令牌交换新的访问令牌。
如果您希望 /oauth/token
端点在此版本之前工作,您可以使用不同的 Stormpath Starter 或禁用 [=34=] 安全性。
对于第一种方法,您可以使用 stormpath-spring-boot-starter
。
对于第二种方法,将以下行添加到您的 application.properties
文件中:
stormpath.spring.security.enabled = false
security.basic.enabled = false
我在这里以 Stormpath 为例: http://docs.stormpath.com/java/spring-boot-web/http-request-authentication.html
目前为止一切正常。
但是当我尝试发出命令时:
curl -X POST --data 'grant_type=password&username=ACCOUNT_USERNAME&password=ACCOUNT_PASSWORD' \
-H 'Origin: http://localhost:8080' http://localhost:8080/oauth/token
我收到这个错误:
<body>
<div class="container-fluid">
<div class="row">
<div class="box col-md-6 col-md-offset-3">
<div class="stormpath-header">
<img src="https://stormpath.com/images/template/logo-nav.png" />
</div>
<div class="logo">
<h1>403</h1>
</div>
<p class="lead text-muted">Expected CSRF token not found. Has your session expired?</p>
<a href="/" class="btn btn-primary">Go Home</a>
</div>
</div>
</div>
</body>
关于如何解决这个问题的任何线索?
您使用的是哪个 Stormpath Spring Boot Starter?
stormpath-default-spring-boot-starter
(和其他)包括 Spring 安全。
目前,Spring 安全和 /oauth/token
与 Stormpath 集成不兼容。
好消息!我们这周真的发布了新的令牌管理集成。即将发布1.0.RC8.3
。您可以跟踪它的状态 here。它通过 Spring 堆栈完美集成,包括 Spring 安全性。它还提供访问和刷新令牌,并支持用刷新令牌交换新的访问令牌。
如果您希望 /oauth/token
端点在此版本之前工作,您可以使用不同的 Stormpath Starter 或禁用 [=34=] 安全性。
对于第一种方法,您可以使用 stormpath-spring-boot-starter
。
对于第二种方法,将以下行添加到您的 application.properties
文件中:
stormpath.spring.security.enabled = false
security.basic.enabled = false