Using Office 365 Portal Security Token for Authentication with custom website

When creating a lot of different web front-ends, it is always rather complex to get started with single sign-on or integrated login.

The simple way to not maintain a credential database or passwords is to validate against a 3. party website.
This is where the Office 365 Portal comes in handy, especially because many companies are already validating against or with it.

I created this code as part of another solution, the example here has been cut down for demonstration purposes and easy integration.
You will be able to validate against Portal.microsoftonline.com as long as the login is allowed for any given user.

It’s easy to add, so after first login we can assign each user to roles/groups or whatever we need.
Specific domains or usernames can of course be enforced.

Login page:

simple login page

If login failed:

And our simple success login page

NOTE: Keep in mind, You must move the tmp location or create a folder called tmp with RW permissions.

Download the source files:

Download “Office365SecurityToken.zip” Office365SecurityToken.zip – Downloaded 109 times – 5 KB

 

By | 2017-12-11T08:59:07+00:00 December 11th, 2017|Office 365, Scripting & Development, Security|1 Comment

About the Author:

Thomas Marcussen
Solutions Architect, Microsoft Certified Trainer & Technology Evangelist with a passion for #Deployment #Configmgr #Azure #Security #Development Personal blog: https://thomasmarcussen.com

One Comment

  1. Rana WhatBestInCanada.com March 17, 2018 at 5:09 - Reply

    Thank you for sharing the code. Now I will try to optimize and keep on the rack.

Leave A Comment