0

I have been using Microsoft Graph APIs in my .NET application to read Calendar, mails and Contacts from Office 365. Now my application uses Access Token for its working, which expires after every one hour and prompts the User to re-login.

My requirement is to extend the token expiry, which can only be done using Refresh Token. I tried to include the scope "offline_access" in my app and it gave me the error "MSAL always sends the scopes 'openid profile offline_access'. They cannot be suppressed as they are required for the library to function. Do not include any of these scopes in the scope parameter."

I have modelled my application on the demo given by Microsoft for Graph APIs and MVC integration on the link: https://learn.microsoft.com/en-us/outlook/rest/dotnet-tutorial

What wrong am I doing here or what am I missing?

Any help would be greatly appreciated.

Mankaran
  • 1
  • 1

1 Answers1

0

The tutorial you are referring to is for the Outlook REST APIs. NOT Microsoft Graph. All Microsoft Graph samples are here https://developer.microsoft.com/en-us/graph/gallery/?filterBy=Samples,SDKs

There is a great getting started page that links to a tutorial to build your first app https://developer.microsoft.com/en-us/graph/get-started/asp.net

This uses MSAL v2.7 SDK that handles the refresh tokens for you and the Microsoft Graph SDK for dotnet.

Jeremy Thake MSFT
  • 2,058
  • 2
  • 13
  • 11
  • Thanks for your reply Jeremy! If you open and have a look at the link that i have given as reference in my question, you will find that the tutorial uses Graph API. Anyways, my question still remains. How will I be able to Refresh Token and what am I currently missing? – Mankaran Feb 08 '19 at 10:23
  • Unfortunately that sampel you link to is using "https://outlook.office.com/api)" not "https://microsoftgraph.com/" This is the Outlook REST APIs, not Microsoft Graph. The link I provide will get you going and handle refresh tokens. – Jeremy Thake MSFT Feb 11 '19 at 16:29