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

Prevent WWW-Authenticate header #37

Open
awdrius opened this issue Jul 1, 2015 · 9 comments
Open

Prevent WWW-Authenticate header #37

awdrius opened this issue Jul 1, 2015 · 9 comments

Comments

@awdrius
Copy link

awdrius commented Jul 1, 2015

Hi,

I'm not sure I'm approaching this right, but when using restify with restify-oauth2 to secure an api endpoint for Web app - I'm getting a login dialog (at least on Chrome). To battle that I forked and added a new option noWwwAuthenticate next to the tokenEndpoint, wwwAuthenticateRealm, etc. and then I have a logic to not set appropriate header in makeErrorSenders.js (for both setWwwAuthenticateHeader and setWwwAuthenticateHeaderWithoutErrorInfo). I think I overlooked something in the docs or/and usage specs. Do reckon there is a proper approach to it?

In case you find this useful - I can create a pull request.

@gmaniac
Copy link
Collaborator

gmaniac commented Jul 2, 2015

if your branch is public post a link I will pull down that and give it a look

@awdrius
Copy link
Author

awdrius commented Jul 2, 2015

Sure. Here it goes: https://github.com/awdrius/restify-oauth2

@gmaniac
Copy link
Collaborator

gmaniac commented Jul 8, 2015

Sorry for the delay.

I am a little confused as to what you are trying to do exactly. Could you give me a use case please?

Could you give an example of your request that you are getting a login dialog box from chrome with?

@awdrius
Copy link
Author

awdrius commented Jul 8, 2015

Hey, no worries, we are all busy.

I'm using your library to authenticate API calls from a JS script. I do that automatically upon user entering the website. If auth call fails - Chrome popups a standard login popup to enter username and password. I do not want that as handling failed logins is a part of JS functionality.

The best description of the issue can be read here:
http://stackoverflow.com/questions/86105/how-can-i-supress-the-browsers-authentication-dialog

@gmaniac
Copy link
Collaborator

gmaniac commented Jul 9, 2015

I will add this in, I was thinking of adding it as an option like tokenExpiration. When it is left blank it will be false and act as it does now. If you pass true it will prepend X- onto Basic which should suppress the popup.

Let me know what you think.

I was going off of this issue as well: #27

@awdrius
Copy link
Author

awdrius commented Jul 28, 2015

Hey, sorry for the late reply, under tons of work to do here.

I haven't investigated the X- suffix cross-browser behavior. It would not surprise me that the auth header forces cred. dialog on Chrome only. I think I noticed that there is a trend towards it from my app log files.

I'll pull the latest changes/fixes on one of the test servers and will let you know how it went.

@awdrius
Copy link
Author

awdrius commented Aug 30, 2015

I checked it and X-Basic workaround would work well here. It's up to you how you want to handle it.

Btw, just wanted to thank you guys for creating an easy to use OAuth2 library.

@gmaniac
Copy link
Collaborator

gmaniac commented Aug 31, 2015

All the thanks goes to @domenic he created this package, I am just helping maintain.

I am currently working on making this package compatible with restify 4.x I am fixing some tests and then I can add these feature in. Probably be within the next two weeks unless you would like to submit a pull request?

@awdrius
Copy link
Author

awdrius commented Sep 1, 2015

I'll see if I can help but I'm not certain I can be that fast (-.

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

No branches or pull requests

2 participants