FortiSOAR Discussions
khanchand
New Contributor II

Authorization code for office365

Hi Community Members,

 

I am facing issue in generating authorization code for office365 application in azure. I am following official fortisoar documents for O365 connector but their is something wrong with the provided URL, upon providing tenant id and client id its showing error. Can someone pass me the correct URL for generating the code. thanks in advance.

 

FortiSOAR 

1 Solution
jankit6
Staff
Staff

Hello @khanchand 

Thank you for reaching out. You can use the same URL as shared in the connector guide.

This is a complete URL that needs to be submitted in the browser after replacing the tenant and client ID. It will return a different URL, use the same redirected URL, and copy the code as mentioned in the below guide.

 

Connector document Guide:

https://docs.fortinet.com/document/fortisoar/4.2.1/exchange/618/exchange-v4-2-1

 

Link to generate Auth code:

https://login.microsoftonline.com/<tenantid>/oauth2/v2.0/authorize?response_type=code&scope=offline_access https://outlook.office365.com/EWS.AccessAsUser.All&client_id=<client-id>&response_mode=query&grant_type=authorization_code

 

View solution in original post

3 REPLIES 3
jankit6
Staff
Staff

Hello @khanchand 

Thank you for reaching out. You can use the same URL as shared in the connector guide.

This is a complete URL that needs to be submitted in the browser after replacing the tenant and client ID. It will return a different URL, use the same redirected URL, and copy the code as mentioned in the below guide.

 

Connector document Guide:

https://docs.fortinet.com/document/fortisoar/4.2.1/exchange/618/exchange-v4-2-1

 

Link to generate Auth code:

https://login.microsoftonline.com/<tenantid>/oauth2/v2.0/authorize?response_type=code&scope=offline_access https://outlook.office365.com/EWS.AccessAsUser.All&client_id=<client-id>&response_mode=query&grant_type=authorization_code

 
khanchand
New Contributor II

Thanks Jankit,

 

It worked, appreciate you support.

srivastavad
Staff
Staff

Here are the general steps to generate an authorization code:

  1. Register Your Application in Azure Portal:

    • Go to the Azure Portal (https://portal.azure.com/).
    • Navigate to the Azure Active Directory service and select "App registrations" or "App registrations (Preview)."
    • Click on "New registration" to register your application.
    • Provide a name for your application, select the supported account types, and specify the Redirect URI (where the authorization code will be sent after authentication).
    • After registering, note down the "Application (client) ID" (Client ID) and "Directory (tenant) ID" (Tenant ID) from the application overview.
  2. Configure Authentication Settings:

    • Under your application's settings, go to "Authentication."
    • Configure the platform you are using (e.g., Web, Single-page application) and enter the Redirect URI.
    • Make sure you configure the necessary permissions (API permissions) for your application to access Office 365 resources.
  3. Generate Authorization Code:

    • To generate an authorization code, you typically need to construct an authorization URL, which includes your client ID, the required permissions (scope), and the authorization endpoint. The URL should look something like this (but may vary depending on your specific configuration):

      • {tenant_id}: Replace with your Azure AD tenant ID.
      • {client_id}: Replace with your application's client ID.
      • {redirect_uri}: Replace with your specified redirect URI.
      • {scopes}: Specify the necessary scopes or permissions required for your application.
  4. Access the URL:

    • Use a web browser or an HTTP client to access the authorization URL.
    • Sign in with your Office 365 account and grant the requested permissions.
    • After successful authentication and consent, you should be redirected to the Redirect URI with the authorization code appended as a query parameter.

Please let us know if this helps.