Search...
Menu

Generate Seamless Login URLs (Private and Mixed Access)

Download

The application scenarios are as follows:

The access rights of the site are set to Private andMixed Access, and you can use the examples provided by us (php, python, nodejs) to generate a link. You only need to guide the user to click the link to complete the visitor login authentication, thereby omitting the authentication process of receiving the verification code.

 

php example

<?php
$token = ''; // AI Integrations -> AI Token
$email = ''; // email
$timestamp = time(); // Current system timestamp (sec), used by us to control the expiration date of this link, the default expiration date is 1 month
$website = 'https://{Customized Domain Name}'; // Help Center Domain Name, https cannot be omitted

$secret = hash("sha256", $email . $phone . $timestamp . $token);
echo $website . "/access?email=$email&phone=$phone&timestamp=$timestamp&secret=$secret";

 

python example

import hashlib
import time

token = ''  # AI Integrations -> AI Token
email = ''  # email
timestamp = int(time.time())  # Current system timestamp (sec), used by us to control the expiration date of this link, the default expiration date is 1 month
website = 'https://{Customized Domain Name}'  # Help Center Domain Name,https cannot be omitted

secret = hashlib.sha256((email + phone + str(timestamp) + token).encode()).hexdigest()
print(website + f"/access?email={email}&phone={phone}&timestamp={timestamp}&secret={secret}")

 

nodejs example

const crypto = require('crypto');

const token = ''; // Backstage->AI Configuration->AI Token
const email = ''; // Mail
const phone = ''; // Phone Number
const timestamp = Math.floor(Date.now() / 1000); // Current system timestamp (sec) Used by us to control the validity period of this link, the default validity period is 1 month
const website = 'https://{custom domain}'; // Help Center domain name,https cannot be omitted

const secret = crypto.createHash('sha256').update(email + phone + timestamp + token).digest('hex');
console.log(`${website}/access?email=${email}&phone=${phone}&timestamp=${timestamp}&secret=${secret}`);

 

 

Generated link example

https://{custom domain}/access?email=&phone=timestamp=1711357679&secret=653b37b44291f43298f7fa1290722f96cb20a7999d93c5f5ae1fb6329bb6ebd3

 

Previous
Recycle Bin Query One-click Clear Processing Result API
Next
SSO Single Sign-On API
Last modified: 2024-11-11Powered by