I am looking for a way to authenticate a user by username/password in a headless manner for Azure AD b2c. Azure AD b2c is great but we feel the redirects for logins can lead to confusion among customers (and sometimes even prevented by some browsers). Also we want to be in full control of the customers UX experience.
I have researched ADAL and the Graph API but have not found anything yet.
Gina
If what you want is headless authentication, why don't you simply use Azure AD alone? It has an API. And if you intend to create and manage all the UI yourself, why would you want or need AD B2C?
As mentioned here, you can use Azure AD Apps for the Client Credential Flow for Service Accounts. It is not optimal but it works.
Note: be sure to create the Azure AD Apps under your B2C Tenant.
Code Snippet to get an Access Token from C#
App ID URI
You will probably want to define some custom claim(s) to secure the Web API. See 'Application Permissions' here.
Modify the application manifest on the Web API Azure AD App
Grant the Service Account Azure AD App permission to the custom application permission(s) defined
The permissions granted to the service account will come back in the
roles
claim:Please upvote the user voice feedback item to make this easier :)
Still in preview (as of Jan 2018) but might be what you're looking for if you're using Azure Functions. Take a look at Microsoft Graph bindings for Azure Functions
It is not currently possible to run Azure B2C without an interactive user present. While I am sure it will arrive at some point, at present, you can't create back-end applications based on B2C.
According to the Azure Active Directory B2C preview: Limitations & Restrictions
What you are looking for is OWIN's resource owner password credentials in azure AD b2c. You can refer https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/13817784-add-support-for-resource-owner-password-credential and upvote for this feature to be implemented
Azure AD B2C cannot offer headless authentication but combining custom journeys
vanity domains and custom styling its possible for users to never leave your site