How to get IMAP Access Token

Marshall Wan || Covertech 0 Reputation points
2023-01-24T04:45:57.9966667+00:00

Hi everyone,

I tried to get IMAP Access Token via Azure AD, but I failed.

I'm still new to this Oauth 2.0 stuff, so I did some research, and according to this YT video, I have followed what was taught, and somehow I still have to get the Access Token.

Any help would be appreciated, thanks in advance.

Regards,

Marshall

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,446 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,629 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Harpreet Singh Matharoo 7,621 Reputation points Microsoft Employee
    2023-01-24T07:02:04.3+00:00

    Hello @Marshall Wan || Covertech

    Thank you for reaching out. While I am not expert on IMAP and Exchange based auth, however I assume following document should help you resolve your issue: Authenticate an IMAP, POP or SMTP connection using OAuth

    You can also check following QnA post on which similar question was answered: [https://learn.microsoft.com/en-us/answers/questions/1112032/outlookoffice365-imap-how-to-get-access-token(api)

    I hope this answer helps to resolve your issue.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. Akshay-MSFT 17,656 Reputation points Microsoft Employee
    2023-02-02T07:13:46.7166667+00:00

    Hello @Marshall Wan || Covertech ,

    Thank you for posting your on Q&A. The video link you shared is using POSTMAN to get access token for IMAP. You could follow Get an access token for getting the access token in same way.

    Within above doc there are 3 ways, of which I would recommend to use OAuth2 authorization code flow.

    1. Auth URL and Access Token URL
    2. User's image
      1. Client ID User's image
    3. Client Secret value, if you don't have one the please generate by clicking on +New Client Secret User's image
    4. Scope must be https://outlook.office.com/IMAP.AccessAsUser.All and a similar permission must be added

    index

    index

    index

    User's image

    • Fill all details in POSTMAN as per below screenshot:
    • User's image
    • Hit "Get New Access Token" and authenticate with your crop credentials (any user assigned to the IMAP app registered in Azure AD)

    Please do let me know if you have any further queries.

    Thanks,

    Akshay Kaushik

    Please "Accept the answer", "Upvote" and share your feedback (Yes/No) if the suggestion works as per your business need. This will help us and others in the community as well.