Hi,
Any one has written code to access SharePoint Office 365 site which has multi factor authentication using JavaScript from different Application like SAP UI5?
SAP UI5 will access SharePoint using JavaScript. It will try to connect SharePoint from Ajax and REST service. Is there anyone written code in similar scenario? Is it possible to authenticate SharePoint using REST service using JavaScript something like below PHP code, I want to write using JavaScript. Please help. If there are some OAuth way of authenticating from UI5 to call SharePoint online also will do along with Multi factor authentication.
Below is the code I have got from net written on PHP. It has passed user id and password but not MFA. I need similar code for UI5 written in JavaScript to authenticate with MFA and call SharePoint online REST service.
| <?php | |
| require_once __DIR__ .'/../../Faker/src/autoload.php'; //Faker library (https://github.com/fzaninotto/Faker) | |
| require_once'SPOClient.php'; | |
| $username ='username@tenant.onmicrosoft.com'; | |
| $password ='password'; | |
| $url ="https://tenant.sharepoint.com/"; | |
| generateContacts($url,$username,$password); | |
| function generateContacts($url,$username,$password){ | |
| $client = new SPOClient($url); | |
| $client->signIn($username,$password); | |
| $list = $client->getList('Contacts'); | |
| $contactsCount = 120; | |
| for($i = 0; $i< $contactsCount; $i++){ | |
| $contactEntry = createContactEntry(); | |
| $item = $list->addItem($contactEntry); | |
| print"Contact '{$item->Title}' has been created succesfully.\r\n"; | |
| } | |
| } | |
| function createContactEntry() | |
| { | |
| .... | |
| } | |
| ?> |