我已经使用Spring-Boot-1.3.1开发了Spring-Rest API。然后,我为这些API提供了Spring-OAuth2安全性。它位于Apache Tomcat中的一个单独项目中。我开发的APIS:
GET -> /api/articles
GET -> /api/articles/1
POST -> /api/articlesSpring-Oauth2默认提供如下接口:
POST -> /oauth/token
POST -> /oauth/authorize和一些更高级的api。
现在我正在开发AngularJS UI,它将驻留在不同的服务器- Apache2-Http服务器。
我需要知道如何将angularJS登录页面与Spring-OAuth2保护的Spring-REST集成在一起?
发布于 2016-01-09 06:31:16
发布于 2017-02-09 09:43:38
使用以下代码:
var data = "username=" + user.email + "&password=" + encodeURIComponent(user.password) + "&grant_type=password&scope=read%20write&" +
"client_secret=secret&client_id=frontend";
$http.post(portalResources.login, data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
"Authorization": "Basic " + $base64.encode("frontend" + ':' + "secret")
}
});https://stackoverflow.com/questions/34450200
复制相似问题