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 support for authentication #5

Open
developius opened this issue Nov 22, 2017 · 3 comments
Open

Add support for authentication #5

developius opened this issue Nov 22, 2017 · 3 comments

Comments

@developius
Copy link

Currently if the gateway is secured via basic auth, an error is thrown. Would be good to add support for this.

From a UX perspective, I reckon this would be good:

const OpenFaaS = require('openfaas')
const openfaas = new OpenFaaS('gateway:8080', {
    user: 'admin',
    password: 'secret'
})

Not sure how this works with got, it currently throws Basic authentication must be done with auth option but I can't find documentation for that specific option.

@austinfrey I can pick this up if you want?

@austinfrey
Copy link
Owner

austinfrey commented Nov 22, 2017

@developius I'm pretty sure you can just use {auth: "user:password"} in the options object. I'm thinking that anything passed into options get passed on to http.request. Let me know if that works for you.

maybe we should move towards just passing in the options {} as well instead of passing individual args. what do you think?

https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback

@austinfrey
Copy link
Owner

and we should be able to post issues on the Openfaas-incubator repo now :)

@developius
Copy link
Author

Agreed. If we can simply pass the options through that'd be perfect, I wasn't quite sure how got was wrapping http.request but if it does that, we're good 😁

I'd say instead of having a single options object, this would be quite nice:

const openfaas = new OpenFaaS('http://gateway:8080') // check for string

const openfaas = new OpenFaaS({ // check for object
    gateway: 'http://gateway:8080'
    // etc
})

Are we able to move issues? I feel this belongs in the main repo.

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