can you map windows-network-drive from windows service? - javascript

I am using the NPM package windows-network-drive to map a network drive to my windows system. Normally I would pass in undefined for the username and password because I do not need to use different credentials, but when I do this in a windows service, which I mounted through the node-windows npm package, the drive is not mounted and I assume this is because it does not have the credentials, so I then therefor passed in the username and password into the network drive mount. This causes the drive to be mounted, but it says Disconnected Network Drive (J:)
TLDR; Drive is mounting when used with node command but not in windows service.
I have tried
using default credentials
passing in the username and password into the mount
running using node command in terminal (Which works, but does not work as a service)
My code is (with changed username, password, and server):
let networkDrive = require("windows-network-drive");
networkDrive.mount(
`\\\\192.168.1.1/subdir`,
undefined,
"username",
"password"
);
When I mount with the username and password:
When I mount with username and password as undefined it works in the terminal but not in service.

Related

Connect to Firestore Emulator locally and production at the same time

I have the need to connect to my production database in my Firebase Emulator project.
In my case it's to access renewed tokens that I have stored in the production database.
I've tried launching a second instance as stated in the Firestore documentation, and i get the console message:
Non-default "firebase-admin" instance created! - This instance will not be mocked and will access production resources.
However it still connects to my local database.
I've also set:
const settings = { host: 'xxxxxxxxxxx.firebaseapp.com'
}
let db = admin.firestore()
db.settings(settings)
But when inspected, the instance is still set to localhost.
I'm thinking it might have to do with something with process.env.FUNCTIONS_EMULATOR that overrides the settings?
Any help appreciated!

Apiv2Error : Cannot sign manifest under that username

Getting error while running on expo react native app in local environment iam using AUTH0 for authentication and use authsession.redirecturl(). we are using expo developer service which allow us to add any organization name in app.json owner and login with expo user account . but expo authsession not redirect me to on my project
If you try removing the owner : yourname in the app.json, it should run.

How to authenticate to connect to database in Postgres?

I'm trying to connect to a postgres database from outside the psql command line (so before doing sudo -u postgres psql) but it seems that I'm not able to pass authentication. Here's the error after I try to run a script that connects to that database from the command line:
error: password authentication failed for user "bobby"
"bobby" is my Operating System user name, I noticed that the postgres database contains a superuser called postgres though
I'm new to all this postgres stuff so I'm a bit confused why it's trying to authenticate using my OS user name rather than my psql user name, or rather how I would go about authenticating using the psql user name rather than my OS user name because I know they're separate from each other.
Any help would be appreciated. Thanks in advance.
You need to add your system user name to posgres database
$ psql -d template1 -U postgres
template1=# CREATE USER bobby WITH PASSWORD 'myPassword'
template1=# CREATE DATABASE mydatabase
template1=# GRANT ALL PRIVILEGES ON DATABASE mydatabase to bobby
Done and quit
Then you can access the database with
bobby=#psql mydatabase

Fail to connect Mongolab with MongodbShell

I'm trying to connect the Mongo shell with Mongolab. I am using my mongolab username and password but it is giving an error: "Failed to connect to 54.81.180.188:56789."
My userName and password is correct.
I'm using Windows 8.1
When I ping ds0-----.mongolab.com that's working fine.
C:\mongodb\bin>mongo ds0----.mongolab.com:56789/dbname -u "MyUserName" -p "MyPassword"
MongoDB shell version: 3.0.3
connecting to: ds027751.mongolab.com:56789/dbname
2015-06-05T10:55:30.019+0530 W NETWORK Failed to connect to 54.81.180.188:56789, reason: errno:10061 No connection could be made because the target machine actively refused it.
2015-06-05T10:55:30.024+0530 E QUERY Error: couldn't connect to server ds027751.mongolab.com:56789 (54.81.180.188), connection attempt failed
at connect (src/mongo/shell/mongo.js:181:14)
at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed
I had the same problem, my server abruptly lost the ability to connect to MongoLab. I contacted support, who sent this reply:
Hello,
Your Experimental Sandbox plan is running MongoDB 3.0.x, which
includes changes to Mongo's authentication mechanism. This new
mechanism is supported by certain newer driver versions, as described
at
http://docs.mongodb.org/manual/release-notes/3.0-scram/#upgrade-drivers.
To connect to this database, you will need to use one of the drivers
listed at the above link.
Please let us know if you have questions about this.
Sincerely, Samson
I assume I was upgraded automatically, as I hadn't touched the server code or MongoLab in months. As an immediate fix, I just created a new db in MongoLab, which was created in mongod v2.6.9 (I don't remember seeing an option to choose the version).

How to always get email for users signing in with Github

I use meteor with packages:
accounts-ui 1.0.0 Simple templates to add login widgets to an app
accounts-password 1.0.0 Password support for accounts
accounts-github 1.0.0 Login service for Github accounts
I need to get email when users sign up using Github account. I use code on client side:
Accounts.ui.config({
requestPermissions: {
github: ['user:email']
}
});
However, when I sign up, than I see in console:
Meteor.user()
...
{"_id":"(redacted)",
"profile":{"name":"Jacek Migdal"},
"services":{
"github": {"accessToken":"(redacted)","email":null,"id":(redacted),"username":"jakozaur"},
"resume":{"loginTokens":[{"when":"2014-09-01T19:20:50.655Z","hashedToken":"(redacted)"}]}},
"createdAt":"2014-09-01T19:18:08.064Z"
}
Why do I get null in email field? Is it a bug or am I doing sth wrong?
Github no longer gives out the email address this way.
See this post on how to extract it when the user logs in: the accounts-github package is causing my meteor user to have a null email

Categories