jump

OnlineExamMaker Single Sign-On

Single sign-on (SSO) allows candidates to log in their own system only and click on the online exam entrance to take exams without login their candidate accounts again.

For example, one company has his own OA system and use SSO, an employee logs into the OA system, he can click the entrance of the exam in the system without login his OnlineExamMaker account again.

Note: OnlineExamMaker API is only available for Premium users, if you want to request data from OnlineExamMaker API, please upgrade your account to Premium member.

1. Online exam taker login with SSO

The SSO to Exam allows exam takers to click the exam entrance directly on the user system to enter the exam, and no additional identity authentication is required.

Online exam taker login with SSO:

GET https://api.onlineexammaker.com/newstudentsso

Parameter:

userId=user id&loginValue=exam verification information&password=candidate password&eid=exam id&aspart=0&rflag=0&expiretime=1

Parameter description:

  • code: Verification code is unique to each OnlineExamMaker account, Premium users can get it in "System Settings" -> "API & SSO Settings" in OnlineExamMaker dashoboard. (Related tutorial: How to get verification code for API?)
  • time: Current timestamp, for example: 1638768935.
  • userId: User id.
  • loginValue: The unique login field of exam takers,you can use student email, or phone number as loginvalue.
  • password: Candidate password.
  • eid: Exam id.
  • aspart: 1, remove the sidebar; 0, keep the sidebar.
  • rflag: If a candidate log in to the candidate backend, you can specify to automatically jump to the corresponding page after login in, and get the front-end routing information connected to the candidate backend page
  • expiretime: Authentication expiration time, expiretime should be greater than 0 and less than 15, corresponding to 1-14 minutes.

If the operation is successful, the return value is:

{
    "data": "https://api.onlineexammaker.com/login/u/api/112?rflag=0\u0026loginValue=13240935349\u0026password=13240935349\u0026eid=3506\u0026token=a05d2c44c08d87c2243315d63e35d274\u0026aspart=0",
    "status": "ok"
}

If the operation fails, the return value is:


Interface usage examples:

package main

import (
    "crypto/md5"
    "fmt"
    "io/ioutil"
    "log"
    "net/http"
    "os"
    "strconv"
    "time"
)

const (
    Code = "xxx"
)

func main() {
    host := "https://api.onlineexammaker.com"
    resource := "/newstudentsso"

    client := &http.Client{}
    fullPath := host + resource

    req, _ := http.NewRequest(http.MethodGet, fullPath, nil)
    time64 := time.Now().UTC().Unix()
    ParseToken := fmt.Sprintf("%x", md5.Sum([]byte(strconv.FormatInt(time64, 10)+Code)))
    req.Header.Set("Authorization", ParseToken)

    q := req.URL.Query()
    q.Add("code", Code)
    q.Add("time", strconv.Itoa(int(time64)))
    q.Add("userId", "1")
    q.Add("loginValue", "2")
    q.Add("password", "3")
    q.Add("eid", "4")
    q.Add("aspart", "0")
    q.Add("rflag", "0")
    q.Add("expiretime", "1")

    req.URL.RawQuery = q.Encode()

    resp, err := client.Do(req)
    if err != nil {
        log.Println(err)
        return
    }

    defer resp.Body.Close()

    b, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Println(err)
        return
    }

    // fmt.Println(string(b))
    f, _ := os.OpenFile("test.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
    f.Write(b)
}

2. Candidate dashboard login with SSO

The principle of single sign-on to the candidate dashboard is the same as single sign-on to the online exam, the difference is that the eid parameter is not passed or 0 is passed.

When the system determines that the eid is 0, it will automatically jump to the candidate dashboard interface.

Candidate dashboard login with SSO

GET https://api.onlineexammaker.com/newstudentsso

Parameter:

userId=user id&loginValue=exam verification information&password=candidate password&eid=exam id&aspart=0&rflag=0&expiretime=1

Parameter description:

  • code: Verification code is unique to each OnlineExamMaker account, Premium users can get it in "System Settings" -> "API & SSO Settings" in OnlineExamMaker dashoboard. (Related tutorial: How to get verification code for API?)
  • time: Current timestamp, for example: 1638768935.
  • userId: User id.
  • loginValue: The unique login field of exam takers,you can use student email, or phone number as loginvalue.
  • password: Candidate password.
  • eid: Exam id.
  • aspart: 1, remove the sidebar; 0, keep the sidebar.
  • rflag: If a candidate log in to the candidate backend, you can specify to automatically jump to the corresponding page after login in, and get the front-end routing information connected to the candidate backend page
  • expiretime: Authentication expiration time, expiretime should be greater than 0 and less than 15, corresponding to 1-14 minutes.

If the operation is successful, the return value is:

{
    "data": "https://api.onlineexammaker.com/login/u/api/112?rflag=0\u0026loginValue=13240935349\u0026password=13240935349\u0026eid=0\u0026token=a05d2c44c08d87c2243315d63e35d274\u0026aspart=0",
    "status": "ok"
}

If the operation fails, the return value is:


Interface usage examples:

package main

import (
    "crypto/md5"
    "fmt"
    "io/ioutil"
    "log"
    "net/http"
    "os"
    "strconv"
    "time"
)

const (
    Code = "xxx"
)

func main() {
    host := "https://api.onlineexammaker.com"
    resource := "/newstudentsso"

    client := &http.Client{}
    fullPath := host + resource

    req, _ := http.NewRequest(http.MethodGet, fullPath, nil)
    time64 := time.Now().UTC().Unix()
    ParseToken := fmt.Sprintf("%x", md5.Sum([]byte(strconv.FormatInt(time64, 10)+Code)))
    req.Header.Set("Authorization", ParseToken)

    q := req.URL.Query()
    q.Add("code", Code)
    q.Add("time", strconv.Itoa(int(time64)))
    q.Add("userId", "1")
    q.Add("loginValue", "2")
    q.Add("password", "3")
    q.Add("eid", "4")
    q.Add("aspart", "0")
    q.Add("rflag", "0")
    q.Add("expiretime", "1")

    req.URL.RawQuery = q.Encode()

    resp, err := client.Do(req)
    if err != nil {
        log.Println(err)
        return
    }

    defer resp.Body.Close()

    b, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Println(err)
        return
    }

    // fmt.Println(string(b))
    f, _ := os.OpenFile("test.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
    f.Write(b)
}

3. Sub-admin login with SSO

Sub-admins can sign in the dashboard using SSO, here is the interface:

Request

GET https://admin.onlineexammaker.com/index.php?option=com_exams&task=api.childAdminSSO&format=raw

Request data

code=authorization code&email=email&password=password
  • code: Verification code is unique to each OnlineExamMaker account, Premium users can get it in "System Settings" -> "API & SSO Settings" in OnlineExamMaker dashoboard. (Related tutorial: How to get verification code for API?)

  • email: The email of the sub-admin, this value is required.

  • password: The password of the sub-admin, this value is required.

After the sub-admin login successfully, the system will redirect to the sub-admin dashboard automatically.