AngularJS 的 OAuth2 模块 angular-oauth2
- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/seegno/angular-oauth2
- 软件文档: https://github.com/seegno/angular-oauth2
软件介绍
angular-oauth2 是 AngularJS 的 OAuth2 认证模块,使用 ES6 编写。
使用方法:
1. 引入 js 库:
<script src="bower_components/angular/angular.min.js"></script> <script src="bower_components/angular-cookie/dist/angular-cookie.min.js"></script> <script src="bower_components/query-string/query-string.min.js"></script> <script src="bower_components/angular-oauth2/dist/angular-oauth2.min.js"></script>
2. 配置 OAuth 和 OAuthToken
angular.module('myApp', ['angular-oauth2'])
.config(['OAuthProvider', function(OAuthProvider) {
OAuthProvider.configure({
baseUrl: 'https://api.website.com',
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
});
}]);
3. 错误处理:
angular.module('myApp', ['angular-oauth2'])
.run(['$rootScope', '$window', function($rootScope, $window) {
$rootScope.$on('oauth:error', function(event, rejection) {
// Ignore `invalid_grant` error - should be catched on `LoginController`.
if ('invalid_grant' === rejection.data.error) {
return;
}
// Redirect to `/login` with the `error_reason`.
return $window.location.href = '/login?error_reason=' + rejection.data.error;
});
}]);
HTML5与CSS3权威指南(上册) (第3版)
陆凌牛 / 机械工业出版社 / 2015-9-1 / CNY 89.00
本书是HTML 5与CSS 3领域公认的标杆之作,被读者誉为“系统学习HTML 5与CSS 3的最佳著作”和“Web前端工程师案头必备图书之_”。 前两版累计印刷超过15次,网络书店评论超过8000条,98%以上的评论都是五星级的好评。不仅是HTML 5与CSS 3图书领域当之无愧的领头羊,而且在整个原创计算机图书领域是佼佼者。 第3版首先从技术的角度根据最新的HTML 5和CSS 3......一起来看看 《HTML5与CSS3权威指南(上册) (第3版)》 这本书的介绍吧!
