Azure Function Login Sample
Last updated
Last updated
(c) 2024 Data Illusion Zumbrunn. All rights reserved. Reproduction strictly forbidden.
This example shows a simple example of an authentication form that will gather respondent credentials, validate the credentials remotely using an Azure's function and return the full information of the user to the survey.
First start by setting up the user interface of your security function to ask the username and password from respondent.
Then log into your Azure online portal to create a new Azure functions that will get the data posted by the user interface we have just created as a json object eg: {username:'value', password:'value'} and return a proper user object if the credential are valid.
ngSurvey expect to receive from the end point a simple json object eg: {name:'value', firstName:'value'}, all these properties of the object will be saved along respondent answers and can be used and piped anywhere in questions / answers using __lowercasepropertyname__ . In our example we can use __name__ to pipe the name returned by our azure function in any part of our survey.
Any kind of errors that must be returned from the http end point must be returned as an Http Bad Request with the message that will be shown to the respondent
Here our basic Azure function code that will check for the fake user credentials
That's it! You just extended ngSurvey with some new custom login business logic using a remote Azure function.