Login .Net Identiy User Using Jwt NodeJs Api - javascript

Converting .Net api into Node.js, now I need to login user using Identity table using...
var user = _userManager.FindByNameAsync(userDto.Username).Result;
var result = await _userManager.CheckPasswordAsync(user, userDto.Password);
One option is to use plain query but it does not seem like a feasible solution.
Please kindly let me know what should I do?

Related

how to check name availability of storage account using JS SDK

as a request from azure to have globally-unique Storage name, I'm trying to figure out a way to check if the Storage Account name is available or not using javascript SDK,
but I didnt find anything in the Azure js SDK.
I did found REST API:
https://learn.microsoft.com/en-us/rest/api/storagerp/storage-accounts/check-name-availability
but i'm not sure how to use it using javascript. and i dont want to use header and subsicropionid maunnly, I would like to use token and then try to use the api.
but if JS SDK have this function it will be great.
I did found for the container but this is not what i wanted.
You can use #azure/arm-storage package. Please refer to this sample: https://github.com/Azure/azure-sdk-for-js/blob/62662f54163b5ee41cb64a2610a1b65276b59988/sdk/storage/arm-storage/samples-dev/storageAccountsCheckNameAvailabilitySample.ts#L31
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.storageAccounts.checkNameAvailability(
accountName
);

Sending an email using Azure SDK

I use azure-graph in my Node.js project:
const MsRest = require('ms-rest-azure');
const credentials = await MsRest.loginWithServicePrincipalSecret(keys.appId, keys.pass, keys.tenantId, { tokenAudience: 'graph' });
const GraphkManagementClient = require('azure-graph');
const client = new GraphkManagementClient(credentials, subscriptionId);
return client.users.get(principalID);
I want to use the Azure SDK also to send emails.
I know how to do that in low level using the API directly:
But I want to do it via the SDK like the rest of my project.
My problem is, I have not found any method for sending an email in the docs: azure-graph package. I need a method that allows me (with the proper privileges of course) to send email as any user in the organization.
You can use the Graph JavaScript SDK which is a wrapper around the Microsoft Graph API that can be used server-side and in the browser to send mails to users. Please refer to Graph Javascript SDK to learn more about the same. Also, refer to nodejs-connect-sample to use Microsoft Graph API and the Graph JavaScript SDK to send an email.

Login into twitter from personal website

I wish to create a login for my website using Twitter. I wish to let the user type his Twitter Handle inside a textbox and once he enters I need to validate it by making an API call to Twitter and confirm that and need to display the Twitter name of the user and his twitter profile pic. Is this possible using plain JavaScript to implemet this feature? As Twitter is using OAuth for authentication now, can this be implemented with only JS? Kindly, pass on any links if you know. Thanks in advance :)
After some research, I cam across this amazing node based API, twit, whcih can be installed just by saying npm install twit.
You can also get the details on https://github.com/ttezel/twit.
Best part of this plugin is, it takes care of all the authorization with Twitter and gives you a set of methods.
Code example :
var twit = require('twit');
var T = new twit(config_parameters); // contains you access tokens;
T.get('users/show', { screen_name: twitterHandleName},
function(err, data, response) {
console.log(data);
});
});
It has many utility methods that help to resolve your queries that you require from Twitter

how to get account details when integrating plaid api

I am actually trying to integrate Plaid api for ACH payments and following "https://plaid.com/docs/link/" tutorial in Ruby. In this I have written the js code and it shows me pop up to select bank accounts.
I am using it in sandbox mode in which I am using test credentials to verify the account and it successfully verifies the account. For server side scripting I have installed plaid gem and configured it using following code into my_app/config/initializers/plaid.rb
Plaid.config do |p|
p.customer_id = 'test_id'
p.secret = 'test_secret'
p.environment_location = 'https://tartan.plaid.com'
end
where I have replaced the customer_id and secret key with my own. I am using a user controller in which under create method I am trying to create a user like this:
user = Plaid.add_user('auth', 'plaid_test', 'plaid_good', 'usaa', '1234')
Now I am confused how would it work.
I am trying to create a server side handler using ruby but I dont understand where I am lacking (as I am new to Ruby). I actually want that after successfully validating credentials there should be an option to select account like in the given demo
https://demo.plaid.com/stripe
I really need help as I am badly stuck in this from last three days. Any help would be appreciated. Thanks
Plaid Link returns a 'public_token' - you'll need to use the /exchange_token API endpoint to exchange the public token for an API access token.
The plaid-ruby library has a detailed example of the exchange token flow!

converting facebook javascript sdk variables into asp variables?

I have a facebook sign up and login button build using js sdk. I want to store user response into a database, but I cant get the userID or User.email with classic asp.
Sometimes it works, sometimes not, can't find pattern.
var email=response.email;
var fbid=response.id;
var fbname=response.name;
var fbbirthday=response.birthday;
var fbhometown=response.hometown.name;
document.getElementById('fbmail').value = email;
document.getElementById('fbid').value = fbid;
document.getElementById('fbname').value = fbname;
document.getElementById('fbbirthday').value = fbbirthday;
document.getElementById('fbhometown').value = fbhometown;
You can use classic ASP to get all of that information server-side. You would need to build your own framework to wrap up the HTTP Get/Post/Delete commands to the Graph API. But to accomplish getting that basic user information should be fairly straight forward once you have nice wrappers around those three HTTP verbs.
A quickie solution would be to FORM post those values back to the server. I assume you have https, so security shouldn't be an issue.

Categories