Deepling of url of microflow and OIDC

0
Hi, in mendix, I have a microflow with an url, but when I open the url using the SSO with OIDC module, it shows the default page and not the url of the microflow. How to configure OIDC so that it show the url of the microflow ? Thanks
asked
1 answers
0

Hi,

I finally managed it with cookies and no changes on OIDC setup : 

- add script to theme\web\login.html (bellow)

- add a nanoflow on the page after redirect and add a dataview with data source a nanoflow that executes the javascript

 

 

## page after redirect

var redirectUrl = '';

let value = "; " + document.cookie;

let parts = value.split("; " + 'redirect-url' + "=");

if (parts.length === 2) {

redirectUrl = parts.pop().split(";").shift();

//remove the cookie

document.cookie = 'redirect-url=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';

window.location.href = redirectUrl;

}

 

## script to theme\web\login.html

        <script>function getBaseURL(url) {    const regex = /^(https?:\/\/[^\/]+)/;    const match = url.match(regex);    var url = match ? match[1] : "";    if (url.endsWith('/')) {        url = url.slice(0, -1);    }    return url;}

function setCookie(name, value, days) {    let expires = "";    if (days) {        const date = new Date();        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));        expires = "; expires=" + date.toUTCString();    }    document.cookie = name + "=" + (value || "") + expires + "; path=/";}    function removeStartingSlash(text) {    return text.replace(/^\/+/, '');}

function extractFragment(url) {    var arr = url.split('#');    if(arr.length > 1){        return removeStartingSlash(arr[1] || "");    }    return "";}    

const baseUrl = getBaseURL(window.location.href);//http://localhost:8080/login.html#/OpenOffer/13 => http://localhost:8080const fragment = extractFragment(window.location.href);//OpenOffer/13const redirectUrl =  baseUrl + "/p/" + fragment;if(fragment != ''){    setCookie("redirect-url", redirectUrl, 1);}                </script>

answered