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

Another go at an OAuth module #24

Merged
merged 4 commits into from
Feb 29, 2016
Merged

Another go at an OAuth module #24

merged 4 commits into from
Feb 29, 2016

Conversation

rogerhutchings
Copy link
Contributor

I rewrote my previous implementation largely from scratch, and I think it's a lot better for it.

This version will eventually do all token handling itself, and request new tokens via an iFrame, so no page redirects are needed outside of the initial auth. That's currently blocked by zooniverse/panoptes#1673

It'll also have a much simpler API - init to enable URL watching etc, then checkCurrent, signIn and signOut.

Currently a work in progress, please do not merge.

@rogerhutchings rogerhutchings force-pushed the oauth-module branch 3 times, most recently from c3441d5 to 699e1d7 Compare February 16, 2016 16:31
@rogerhutchings rogerhutchings changed the title Another go at an OAuth module - WIP Another go at an OAuth module Feb 21, 2016
@rogerhutchings
Copy link
Contributor Author

This is ready to go now. The API is as follows:

init(appID) 
    - takes a Panoptes app id as an argument
    - sets up a watcher to deserialize any token details found in the URL
    - attempts to pick up any existing Panoptes sessions, should be run at app start

signIn(redirectUri)
    - takes a redirect URI as an argument
    - clears any existing session, and redirects to Doorkeeper to sign the user in

signOut()
    - signs the user out

checkCurrent()
    - attempts to retrieve the authorized user object

Fix #13


console.log('Using OAuth (implicit grant) for login');
console.info('Setting app ID to', appID);
ls.get(LOCAL_STORAGE_PREFIX + 'clientAppId', appID);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be ls.set?

@simoneduca
Copy link
Contributor

@brian-c are your comments blocking the merge? If so, I'm not sure when @rogerhutchings will be able to address them. I'd be happy to have a look too.

@brian-c
Copy link
Contributor

brian-c commented Feb 29, 2016

I still haven't been able to get this to work. Will run through it again today.

@simoneduca
Copy link
Contributor

Cool thanks, let me know how it goes please.

@brian-c
Copy link
Contributor

brian-c commented Feb 29, 2016

Workin' fine now. Will look into figuring out a nice way to test automate testing this.

brian-c added a commit that referenced this pull request Feb 29, 2016
Another go at an OAuth module
@brian-c brian-c merged commit 8499ec2 into master Feb 29, 2016
@brian-c brian-c deleted the oauth-module branch February 29, 2016 17:47
@brian-c
Copy link
Contributor

brian-c commented Feb 29, 2016

Published in v2.1.0.

@simoneduca
Copy link
Contributor

👍

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.

3 participants