GetOneTimeLoginLink and GetOnetimeRegisterLink APIs¶
Prerequisites¶
Obtain API credentials from your TouchPoint instance.
Authentication to the API requires a user with both the Developer and APIOnly roles. The username and password for this user are used only in the Basic Authentication HTTP header for authorizing the use of the APIs.
Usage¶
When you call these APIs, you are acting on behalf of another user to provide them easy access to TouchPoint pages without needing to sign in again. If you want to have your users sign in to your church’s web site, you can authenticate their credentials using the TouchPoint APIPerson/Login API. This API also returns basic information regarding this person. Once a user is validated, you can allow them to interact with pages in TouchPoint as if they had logged in there normally using these APIs. Consider the following workflow:
A user visits your website (i.e. mychurch.org) and logs in using their TouchPoint user name and password.
This uses the APIPerson/Login API from your backend website code.
This user can interact with your website which can provide links to registrations, giving pages, and the user’s profile in TouchPoint.
The user clicks one of these links.
Your website receives the requested link and processes it by requesting a OneTimeLoginLink from TouchPoint.
This uses the APIPerson/GetOneTimeLoginLink API from your backend website code.
Your website then redirects the user to the link returned from the API.
The user is automatically signed in to TouchPoint using the parameters in the link which instantly expires and cannot be used again.
GetOneTimeLoginLink API¶
Description: Get a URL that will automatically sign in the specified user and redirect them to the link specified. The link can only be used once and can only be used for the specified user.
Examples:
C#
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.tpsdb.com/APIPerson/GetOneTimeLoginLink"); request.Headers.Add("Authorization", "Basic YWRtaW46YXNkZjtsa2o="); var content = new MultipartFormDataContent(); content.Add(new StringContent("/Person2/0"), "url"); content.Add(new StringContent("wsupport"), "user"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());
Output:
https://sandbox.tpsdb.com/Logon?ReturnUrl=%2fPerson2%2f0&otltoken=O_um5j8DEEumz5sVV9seZQ
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://sandbox.tpsdb.com/APIPerson/GetOneTimeLoginLink', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('url' => '/Person2/0','user' => 'myuser'), CURLOPT_HTTPHEADER => array( 'Authorization: Basic bXl1c2VyOm15cGFzc3dvcmQ=' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
Output:
https://sandbox.tpsdb.com/Logon?ReturnUrl=%2fPerson2%2f0&otltoken=O_um5j8DEEumz5sVV9seZQ
GetOneTimeRegisterLink API¶
Description: Get a URL that will automatically sign in the specified user and redirect them to the registration for the Involvement specified. The link can only be used once and can only be used for the specified user.
Examples:
C#
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.tpsdb.com/APIPerson/GetOneTimeRegisterLink"); request.Headers.Add("Authorization", "Basic bXl1c2VyOm15cGFzc3dvcmQ="); var content = new MultipartFormDataContent(); content.Add(new StringContent("2188000"), "OrgId"); content.Add(new StringContent("3199254"), "PeopleId"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());
Output:
https://sandbox.tpsdb.com/OnlineReg/RegisterLink/sgECWRirzEOY3XI2FuMOsg
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://sandbox.tpsdb.com/APIPerson/GetOneTimeRegisterLink', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('OrgId' => '2188000','PeopleId' => '3199254'), CURLOPT_HTTPHEADER => array( 'Authorization: Basic bXl1c2VyOm15cGFzc3dvcmQ=' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
Output:
https://sandbox.tpsdb.com/OnlineReg/RegisterLink/sgECWRirzEOY3XI2FuMOsg