I am not able to login through the Default login page with real world API

I am not able to login through the Default login page with real world API. How can I do so?

For the login screen, vdesigner already has some built in templates for Login screen under downloads → flutter → application propeties → login template → default…
To consume real world API, you need to configure two services:

  1. AUTH
  2. SPTBGETLOGINDETAILS

NOW, Let’s integrate it directly with a backend API:

Example Integration:
Assuming you have two 3rd party API’s available

  1. https://{DOMAIN}:{PORT}/users/login
    with request body params in json:
    a. username
    b. password

  2. https://{DOMAIN}:{PORT}/users/detail/{userId}
    request body params
    {}

You can configure these API’s following way

  1. Create a new API in vConnect called “AUTH”
  2. Under the End Point details tab → Create new Env Variable called “APP_LOGIN_URL” with value “ http://{DOMAIN}:{PORT}/users/login
  3. Click the Method list to select the POST method.
  4. Select “Simple Request” in the Request Transformation drop down list
  5. Select “Is the URL have dynamic path variables?”
  6. Under the Template body Parameters Mapping tab-> In parameter 1, enter empcode in the Name box and select Request_body in the Source of Value list. In the Value box, enter $.LOGIN_ID. In parameter 2, enter password in the Name box and select Request_body in the Source of Value list. In the Value box, enter $.password.
  7. Under the Path Param Details tab-> Create two new variables: DOMAIN and PORT and link them to the APP_DOMAIN and PORT environment variables respectively
  8. Save and export it as Service

Similarly, create another API name SPTBGETLOGINDETAILS

  1. Create a new API in vConnect called “SPTBGETLOGINDETAILS”

  2. Under the End Point details tab → Create new Env Variable called “APP_GET_USER_DETAIL” with value “ http://{DOMAIN}:{PORT}/users/{empcode} ”

  3. Click the Method list to select the GET method.

  4. Select “No transformation” in the Request Transformation drop down list

  5. Select “Is the URL have dynamic path variables?”

  6. Under the Path Param Details tab

  7. DOMAIN as Env → APP_DOMAIN

  8. PORT as Env → PORT

  9. empcode as Header → loginid

  10. Save and export it as Service

1 Like