I'm trying to use the Node module Request to authenticate on a website, and after following instructions I still can't seem to figure it out...
Using Coffeescript I've done the following:
Request {
url: "https://#{encodeURIComponent(config.email)}:#{encodeURIComponent(config.password)}@#{config.loginURL}"
}, (error, response, body) ->
if error
console.log error
else
console.log body
The config
values are, respectively, an email, password, and the URL. The URL is app.shopify.com/services/partners/auth/login
. Also, because the username is an email address, I thought it be best to encodeURIComponent
the login values.
When I run this I don't get an error, but the output of the body
is just the markup of the login page.
I've also tried doing it like this:
Request.get config.loginURL, {
auth: {
username: config.email
password: config.password
sendImmediately: false
}
}, (error, response, body) ->
if error
console.log error
else
console.log body
In this case, because the credentials aren't part of the URL, I haven't encodeURIComponent
'd them. Also, the login URL has https://
prepended to it.
Can anyone guide me in the right direction?