[SalesForce] Connecting to Salesforce using AngularJS

newb here.

I am trying to log in to a Salesforce account using AngularJS ForceNG and pull the data out of an object so I can post it on an Ionic page. I want to hard code the login and password, access the Salesforce REST API, query it, and run that information on a page. The trouble that I am having is with gaining access to the Salesforce account.

I know that I need to use OAuth in order to do this. I have not found any examples on the internet regarding how to access Salesforce directly using OAuth with hardcoding the login and password. All examples I find are very long pieces of code with many different update/create/etc. options.

I just want to log in, query the data, and post it onto a web page. It seems like it should be a simple thing to do but I am having immense trouble with it.

Does anybody have any tips on how to hard code the login and pull the data in OAuth?

Best Answer

You can follow the Username-Password flow. That way you don't have to redirect a user to a login page.

The username-password authentication flow can be used to authenticate when the consumer already has the user’s credentials. In this flow, the user’s credentials are used by the application to request an access token as shown in the following steps.

Complete docs are here