How to setup an Microsoft social login on a website

Artwork Decorações 0 Reputation points
2024-03-09T20:44:05.3733333+00:00

Hello, im trying to insert an social login on my website with azure, but i dont know exactly how to proceed since i started programmation a while ago, i already created the aplication, the client ID and the client secret, but i dont know exactly what else i need to do or what code (HTML, Javascript or CSS) to use so i can insert it in the website login page.

Is there an specific code or does it work like other social login like Google?

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
212 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. hossein jalilian 4,695 Reputation points
    2024-03-10T00:30:27.79+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    Implementation Steps:

    1. Include the Microsoft Authentication Library (MSAL) in your project:
    <!-- Add this script to your HTML page -->
    
    1. Set up MSAL Configuration:
    const
    

    Replace 'your-client-id', 'your-tenant-id', and 'your-redirect-uri' with your actual values.

    1. Implement Sign-In Button:
    
    <button id="signIn" onclick="signIn()">
    
    1. Implement Sign-In Function:
    function
    
    1. Handle Token Retrieval:
    function
    
    1. Implement Sign-Out Function:
    function
    

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


  2. Suwarna S Kale 301 Reputation points
    2024-03-10T01:08:52.2533333+00:00

    Are you using Azure App service? Please provide me few more details on the configurations which will help to understand your scenario better.

    As you mentioned you have created the aplication, the client ID and the client secret, you may need to decide which identity provider you want to use, such as Azure AD.

    Each identity provider has its own SDKs and libraries. You’ll need to adapt the code based on the chosen provider. Also, consider security aspects like token validation and secure storage of tokens.

    Feel free to post if you have any further questions. If this answer helped, please accept the answer :-)