Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional storages #35

Closed
wants to merge 13 commits into from

Conversation

jarbitlira
Copy link

I add this feature because if I use cordova/phonegab, cookies aren't detected and this plugin doesn't work correctly. For this reason I add the optional storage to localStorage and sessionStorage

@@ -167,8 +167,8 @@ function OAuthProvider() {
};

return $http.post(`${config.baseUrl}${config.grantPath}`, data, options).then((response) => {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this changes, please.

@ruipenso
Copy link
Member

Hi @jarbitlira!

Looks great.

It would be great if you could create a separate service to handle setToken, getToken and removeToken to get a better abstraction. WDYT?

Also, I've added some comments... Mostly, code standards - try to maintain the code standards already in place.

Thanks :)

@joaogranado
Copy link
Member

Hi @jarbitlira could you add tests please?

case 'cookies':
return ipCookie(config.name);
case 'localstorage':
return JSON.parse(localStorage.getItem(config.name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use angular.fromJson instead of JSON.parse.

@joaogranado
Copy link
Member

Please rename the PR from Feature/optional storages to Add optional storages.

@jarbitlira
Copy link
Author

Hi everyone, thanks for yours comments, it's my first time with ES6.

can you give me a guideline about code standards that are you using?

I go to enhance the code, but first could you tell me, what do you think about this feature?

@ruipenso
Copy link
Member

@jarbitlira The feature is good.

We should consider to switch ivpusic/angular-cookie by grevory/angular-local-storage which support multiple storage types, but still misses cookie secure flag option.

Meanwhile, we can add this functionality with your PR.

Regarding the code standards... We don't have them written anywhere. So, you'll need to take a look at the code and try to figure up the best you can. Sorry about that.

@jarbitlira jarbitlira changed the title Feature/optional storages Add optional storages Sep 9, 2015
@jarbitlira jarbitlira force-pushed the feature/optional-storages branch from 31d1a94 to df5abac Compare September 9, 2015 21:21
@jarbitlira jarbitlira force-pushed the feature/optional-storages branch 3 times, most recently from bd8d16e to 4cda40c Compare September 19, 2015 03:53
@jarbitlira jarbitlira force-pushed the feature/optional-storages branch from 4cda40c to 9ad4491 Compare September 19, 2015 03:54
@jarbitlira jarbitlira force-pushed the feature/optional-storages branch from 756f225 to 2a9404d Compare September 20, 2015 21:33
@ugurerkan
Copy link

+1 for angular-local-storage
Is there any planned date for merge this PR?
BTW I'm using at your branch now @jarbitlira. Good work, congrats and many thanks 😌

@smarts
Copy link

smarts commented Oct 19, 2015

I think it hasn't been merged yet because no tests have been added.

@adozenlines
Copy link

+1 right now the auth response isn't being serialized to the $cookie store ...

@jonkoops
Copy link

I've gone ahead and made a separate pull request that replaces ngCookies with sessionStorage. sessionStorage works basically everywhere so we don't need to fall back to cookies. As for choosing between session and local storage we can tackle at a later point in time.

@joaogranado
Copy link
Member

Closing this PR based on what was said at #95 and #97.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants