These docs are for v20.3.44. Click to read the latest docs for v20.3.186.

Discussions

Ask a Question
Back to All

CORS Error SSO Client App

(edited)

What's been done

Setup
  • Setup Virtual Machine and installed iMIS.
  • Added iMIS to IIS.
  • Added Client App to iMIS.
  • Added Single Sign On iPart to new link in Menu on iMIS.
  • Configured ClientId and Client secret on Client Applications in iMIS.

Coding

  • Created a new project in Visual Studio (ReactJS Front End)
  • Configured Controller Classes to listen to POST request (Step 2 in SSO Docs section titled 'How Does Single Sign On Work?')
  • Created 'fetch' that sends POST request to iMIS token endpoint https://imisteststationfakename.comp.co.za/Asi.Scheduler_iMIS0/token (Step 3 in SSO Docs section titled 'How Does Single Sign On Work?').

Problem/ Progress Block

  • Stored response access_token of Token request in react state accToken.
  • As per step 5 in SSO Docs section titled 'How Does Single Sign On Work?', using the access_token in subsequent calls where the access_token value is a bearer token in the Authorization header causes a CORS error.
  • Using XMLHttpRequest instead of fetch with Authorization header and access_token value causes (CORS error).

What I have tried

  • Using XMLHttpRequest instead of fetch with Authorization header and access_token value causes (CORS error).
  • Checked IIS settings for allowing http verbs/ http responses in iMIS Asi.Scheduler IIS website.
  • Tried using https with self-signed certificate for ClientApp in IIS.
  • Browsed Discussions in the iMIS community for answers from people who have faced similar errors.
  • Took a deep breathe and walked through the documentation for SSO to make sure all steps are understood/implemented correctly.


TL;DR I have followed all the steps for configuring a Single Sign On Client App,
but I cannot use the access_token received by POST'ing to the token endpoint in
subsequent calls to the iMIS API, I am stuck with a CORS error. Please help.