File tree Expand file tree Collapse file tree 7 files changed +27
-30
lines changed Expand file tree Collapse file tree 7 files changed +27
-30
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ Choose your preferred method:
1717###### 1. Download ` angular-oauth2 ` dependencies.
1818
1919* [ angular] ( https://github.com/angular/angular.js )
20- * [ angular-cookie ] ( https://github.com/ivpusic/ angular-cookie )
20+ * [ angular-cookies ] ( https://github.com/angular/bower- angular-cookies )
2121* [ query-string] ( https://github.com/sindresorhus/query-string )
2222
2323If you're using ` bower ` they will be automatically downloaded upon installing this library.
@@ -26,7 +26,7 @@ If you're using `bower` they will be automatically downloaded upon installing th
2626
2727``` html
2828<script src =" <VENDOR_FOLDER>/angular/angular.min.js" ></script >
29- <script src =" <VENDOR_FOLDER>/angular-cookie/dist/ angular-cookie .min.js" ></script >
29+ <script src =" <VENDOR_FOLDER>/angular-cookies/ angular-cookies .min.js" ></script >
3030<script src =" <VENDOR_FOLDER>/query-string/query-string.min.js" ></script >
3131<script src =" <VENDOR_FOLDER>/angular-oauth2/dist/angular-oauth2.min.js" ></script >
3232```
@@ -146,7 +146,8 @@ OAuth.revokeToken()
146146
147147#### OAuthTokenProvider
148148
149- ` OAuthTokenProvider ` uses [ angular-cookie] ( https://github.com/ivpusic/angular-cookie ) to store the cookies. Check the [ available options] ( https://github.com/ivpusic/angular-cookie#options ) .
149+ ` OAuthTokenProvider ` uses [ angular-cookies] ( https://github.com/angular/bower-angular-cookies ) to store the cookies. Check the [ available options] ( https://code.angularjs.org/1.4.0/docs/api/ngCookies/service/$cookies ) .
150+ ** BREAKING CHANGE** : ` angular-oauth2 ` requires angular 1.4 or above in order to store cookies with additional options.
150151
151152Configuration defaults:
152153
Original file line number Diff line number Diff line change 2323 " test"
2424 ],
2525 "dependencies" : {
26- "angular" : " ^1.3.9 " ,
27- "angular-cookie " : " ^4.0.6 " ,
26+ "angular" : " ^1.4.0 " ,
27+ "angular-cookies " : " ^1. 4.0" ,
2828 "query-string" : " ^1.0.0"
2929 }
3030}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module.exports = function(config) {
99 browsers : [ 'Chrome' ] ,
1010 files : [
1111 'bower_components/angular/angular.js' ,
12- 'bower_components/angular-cookie /angular-cookie .js' ,
12+ 'bower_components/angular-cookies /angular-cookies .js' ,
1313 'bower_components/query-string/query-string.js' ,
1414 'node_modules/lodash/dist/lodash.js' ,
1515 'node_modules/angular-mocks/angular-mocks.js' ,
Original file line number Diff line number Diff line change 4747 },
4848 "browser" : {
4949 "angular" : " ./bower_components/angular/angular.js" ,
50- "angular-cookie " : " ./bower_components/angular-cookie /angular-cookie .js" ,
50+ "angular-cookies " : " ./bower_components/angular-cookies /angular-cookies .js" ,
5151 "query-string" : " ./bower_components/query-string/query-string.js"
5252 },
5353 "browserify-shim" : {
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ import OAuthProvider from './providers/oauth-provider';
88import OAuthTokenProvider from './providers/oauth-token-provider' ;
99import oauthConfig from './config/oauth-config' ;
1010import oauthInterceptor from './interceptors/oauth-interceptor' ;
11- import 'angular-cookie ' ;
11+ import 'angular-cookies ' ;
1212
1313var ngModule = angular . module ( 'angular-oauth2' , [
14- 'ipCookie '
14+ 'ngCookies '
1515 ] )
1616 . config ( oauthConfig )
1717 . factory ( 'oauthInterceptor' , oauthInterceptor )
Original file line number Diff line number Diff line change @@ -41,23 +41,23 @@ function OAuthTokenProvider() {
4141 * @ngInject
4242 */
4343
44- this . $get = function ( ipCookie ) {
44+ this . $get = function ( $cookies ) {
4545 class OAuthToken {
4646
4747 /**
4848 * Set token.
4949 */
5050
5151 setToken ( data ) {
52- return ipCookie ( config . name , data , config . options ) ;
52+ return $cookies . putObject ( config . name , data , config . options ) ;
5353 }
5454
5555 /**
5656 * Get token.
5757 */
5858
5959 getToken ( ) {
60- return ipCookie ( config . name ) ;
60+ return $cookies . getObject ( config . name ) ;
6161 }
6262
6363 /**
@@ -101,7 +101,7 @@ function OAuthTokenProvider() {
101101 */
102102
103103 removeToken ( ) {
104- return ipCookie . remove ( config . name , angular . copy ( config . options ) ) ;
104+ return $cookies . remove ( config . name , config . options ) ;
105105 }
106106 }
107107
Original file line number Diff line number Diff line change 44 */
55
66angular . module ( 'angular-cookies.mock' , [ ] )
7- . factory ( 'ipCookie ', function ( ) {
8- return ( function ( ) {
9- var cookie ;
7+ . provider ( '$cookies ', function ( ) {
8+ this . $get = function ( ) {
9+ var cookieStore = { } ;
1010
11- function cookieFun ( key , value , options ) {
12- if ( undefined !== value ) {
13- cookie = value ;
11+ return {
12+ getObject : function ( key ) {
13+ return cookieStore [ key ] ;
14+ } ,
15+ putObject : function ( key , value , options ) {
16+ cookieStore [ key ] = value ;
17+ } ,
18+ remove : function ( key ) {
19+ delete cookieStore [ key ] ;
1420 }
15-
16- return cookie ;
1721 }
18-
19- cookieFun . remove = function ( key , options ) {
20- cookie = undefined ;
21-
22- return ;
23- } ;
24-
25- return cookieFun ;
26- } ( ) ) ;
22+ }
2723 } ) ;
You can’t perform that action at this time.
0 commit comments