Search Unity

Outlook OAuth2 : How to get authorization code from Outlook API for Authentication ?

Discussion in 'Scripting' started by Darkroll, Sep 14, 2017.

  1. Darkroll

    Darkroll

    Joined:
    Jul 29, 2017
    Posts:
    8
    Hi !

    I'm developing a desktop application with Unity and I need to check if the user can log in Outlook to have access to my app.

    So, I'm following this process from Microsoft docs and I'm trying to figure out how I can open Outlook API login page and send to my app the authorization code and then get the access-token to finally obtained information about the user. I tried several ways but without success.

    First, I tried to obtain a kind of AuthenticationContext like We can use in general C# .NET Application by importing some .dlls but It seems that this solution is just a dream.

    Then, I tried this functions I found, but the issue is that Outlook API, like all Microsoft Authentication API (I guess), needs a redirect_uri to send the code and the access-token. If I can get this authorization's code, I think that I could use the functions I found to do what I need. I tried to set a website with a PHP script as redirect_link to get the code and at the same time, do a request to get it.
    But even if I try to get it through this script with a UnityWebRequest it's not working and It's really an ugly way to do it ^^'

    Is there a way to open the Outlook "authorize" page and wait for a response ? Like if I could put the redirect_uri as my desktop application?

    I need your help! And is there a better way to do it than mine?

    Thanks !
     
    Labs_totalmobile likes this.