Difference between revisions of "API SSO"

From zFairs Contest Management
(Created page with "== 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 m...")
 
Line 2: Line 2:
 
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.
 
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.
  
<syntaxhighlight lang="JavaScript" line>
+
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);});
  
fetch('/api/data/sso', {
+
== Where to get values ==
    method:'POST',
+
You will get the person when you use our API to add the person or project. Do not use the project key.
    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);});
 
  
</syntaxhighlight>
 
  
== 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.
+
<br/><br/><br/><br/>
 +
[[Category: API]]

Revision as of 15:03, 3 November 2021

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.