Microsoft SSO with Directus


I am trying to use the Directus auth provider with microsoft SSO in the AppGyver. The thing is that Directus only provides a GET API request to a microsoft login page (i cannot change the redirect property, as it is handled by Directus). The request response is a HTML, and not a json, so i was not able to make the Request API via Appgyver, once the page cannot launch (I am getting CORS error, but i think its the HTML issue).

Get request on postman:

When i enter the Directus GET endpoint in the browser, I am redirected to a Microsoft login page, and only after i login i get the JSON with the auth token in the browser. How can i use the JSON answer in the appgyver with a popup or something?

Microsoft login page (on the browser):

Answer JSON (on the browser)

I tried using the Open URL or Open web browser, and succeeded to login into microsoft, but i cannot access the answer json that i get after login in with the appgyver. Any idea of what should i do?

Thanks a lot!

Hmm not sure if this is possible to get to work at the moment – see if this thread could help you, although since you can’t change the redirect property, maybe not. If you’d do this on mobile I’d recommend doing the Microsoft login in a WebView as it should be easier to access the information that way.

We don’t have a way of opening a web page in a “modal” or something, so I doubt this auth provider will work for you if something like that would be required. I would recommend looking into a different auth provider if possible – I know we have some apps done with Azure auth, so that’d be one possibility. Otherwise you could try to research if this auth provider would be ok in an iframe – we have plans on making an iframe component, but that’s not available yet.

1 Like

Hello. Thanks for the answer :slight_smile: .
I am currently trying to implement the SSO with directus still (I found out that there is a way to redirect to a uri and keep a cookie with the auth token in the session, but im having troubles with the setting the cookie as im hosting in localhost). As I understand, both the app brought foreground via URL and WebView works only for mobile applications is that right? And do you have examples of auth providers that would work for me to testem out? Thanks a lot again!

Yep I think app brought to foreground and WebView only work on mobile.

Hmm other users have used Sashido and Xano at least, and we provide an easy way to use Firebase for auth :thinking: Check those out! :slight_smile: