API SSO

From zFairs Contest Management
Revision as of 14:03, 3 November 2021 by Michael (talk | contribs)

SSO

You can use our api to get a SSO url that will allow you to sign-in a user when they go to that url. This token is only good for one time and expires in just a few minutes. You should only create this token when the user has requested to sso into your zFairs site. If you want to get an SSO URL you need to POST a message to your site. Below is an example of what needs to be posted.

fetch('/api/data/sso', {
	method:'POST',
	headers:{'Content-Type': 'application/json'},
	body: JSON.stringify({
		Username:'admin username',
		Password: 'password',
		FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', //This value can be found in your url it's the value of f
		Body: {
			PersonId:'persons id (36 char GUID)' //Required
		}
	})
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});

Where to get values

You will get the person when you use our API to add the person or project. Do not use the project key.