Giter VIP home page Giter VIP logo

Comments (9)

thobach avatar thobach commented on August 14, 2024

Hi Mirko,
Do you have some more details on your kind of Microsoft account? Is it a personal one or an account managed through Azure Directory?
https://support.microsoft.com/en-us/help/4462988/rest-api-is-not-yet-supported-for-this-mailbox-error has some more details on the problem.

I also adjusted the instructions a bit on https://github.com/thobach/MMM-MicrosoftToDo/blob/master/README.MD as Microsoft change the app registration workflow a bit.

To further trouble shoot the issue it may also be helpful to see if the following command returns an access token:
curl -X POST \ https://login.microsoftonline.com/common/oauth2/v2.0/token \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'client_id=<client id>&scope=offline_access%20user.read%20tasks.read&refresh_token=<refresh token>&grant_type=refresh_token&client_secret=<client secret>'

And if that access token can be used to get the tasks with the following command:
curl -X GET \ 'https://graph.microsoft.com/beta/me/outlook/taskFolders/<list id>/tasks?$select=subject,status&$top=10&$filter=status%20ne%20%27completed%27' \ -H 'Authorization: Bearer <access token>'

from mmm-microsofttodo.

mirko3000 avatar mirko3000 commented on August 14, 2024

from mmm-microsofttodo.

mirko3000 avatar mirko3000 commented on August 14, 2024

Tried your two calls:

  • Yes I can get both access and refresh tokens
  • No the access token still gives me the MailboxNotEnabledForRESTAPI error

Interestingly, if I use the Graph Explorer, I get a different access token. Using that one I can execute the REST call with the above URL...

from mmm-microsofttodo.

thobach avatar thobach commented on August 14, 2024

@mirko3000 In that case maybe your configuration of the Magic Mirror Web App in Azure is different from the Graph Explorer app. This is my configuration:
Bildschirmfoto 2020-05-02 um 10 59 58
Bildschirmfoto 2020-05-02 um 11 00 33
Bildschirmfoto 2020-05-02 um 11 01 08

If you want, you can share your app manifest from https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Manifest/appId//isMSAApp/true so I can run a diff against mine.

from mmm-microsofttodo.

mirko3000 avatar mirko3000 commented on August 14, 2024

I noticed a small different at the "Access tokens" checkbox, now I am getting this error:

{ code: 'MailboxNotHostedInExchangeOnline',
  message:
   'Mailbox is hosted by an on-premise or non-Exchange server, which is not supported.',
  innerError:
   { 'request-id': '14ea8b84-9aa1-4400-88a9-a1424c67b94e',
     date: '2020-05-02T09:13:19' 
  } 
}

After quick research this seems to be a rather new error message. Yes I do not have an exchange account, only Outlook.com. But why it still works in the graph explorer?

from mmm-microsofttodo.

mirko3000 avatar mirko3000 commented on August 14, 2024

Here is my manifest (IDs changed to 1234567890):

{

	"id": "1234567890",
	"acceptMappedClaims": null,
	"accessTokenAcceptedVersion": 2,
	"addIns": [],
	"allowPublicClient": false,
	"appId": "1234567890",
	"appRoles": [],
	"oauth2AllowUrlPathMatching": false,
	"createdDateTime": "2020-04-21T19:12:47Z",
	"groupMembershipClaims": null,
	"identifierUris": [],
	"informationalUrls": {
		"termsOfService": null,
		"support": null,
		"privacy": null,
		"marketing": null
	},
	"keyCredentials": [],
	"knownClientApplications": [],
	"logoUrl": null,
	"logoutUrl": null,
	"name": "MagicMirror",
	"oauth2AllowIdTokenImplicitFlow": false,
	"oauth2AllowImplicitFlow": true,
	"oauth2Permissions": [],
	"oauth2RequirePostResponse": false,
	"optionalClaims": null,
	"orgRestrictions": [],
	"parentalControlSettings": {
		"countriesBlockedForMinors": [],
		"legalAgeGroupRule": "Allow"
	},
	"passwordCredentials": [
		{
			"customKeyIdentifier": null,
			"endDate": "2299-12-30T23:00:00Z",
			"keyId": "1234567890",
			"startDate": "2020-04-26T10:22:06.357Z",
			"value": null,
			"createdOn": "2020-04-26T10:22:07.8474705Z",
			"hint": "=S4",
			"displayName": "MagicMirror"
		}
	],
	"preAuthorizedApplications": [],
	"publisherDomain": null,
	"replyUrlsWithType": [
		{
			"url": "https://localhost:1234",
			"type": "Web"
		}
	],
	"requiredResourceAccess": [
		{
			"resourceAppId": "1234567890",
			"resourceAccess": [
				{
					"id": "1234567890",
					"type": "Scope"
				},
				{
					"id": "1234567890",
					"type": "Scope"
				},
				{
					"id": "1234567890",
					"type": "Scope"
				},
				{
					"id": "1234567890",
					"type": "Scope"
				},
				{
					"id": "1234567890",
					"type": "Scope"
				}
			]
		}
	],
	"samlMetadataUrl": null,
	"signInUrl": null,
	"signInAudience": "AzureADandPersonalMicrosoftAccount",
	"tags": [],
	"tokenEncryptionKeyId": null,
	"verifiedPublisher": {
		"displayName": null,
		"verifiedPublisherId": null,
		"addedDateTime": null
	}
}

from mmm-microsofttodo.

thobach avatar thobach commented on August 14, 2024

The main differences I see are that for me I have:

Maybe this can help with the trouble shooting?

from mmm-microsofttodo.

mirko3000 avatar mirko3000 commented on August 14, 2024

I experimented with the resources, that is why I have 5. Other than that I have no clue what else to do....
Does it work for you with an Outlook.com account?

from mmm-microsofttodo.

mirko3000 avatar mirko3000 commented on August 14, 2024

Ok, so I finally got it working! My guess: German data protection laws do not allow REST APIs. I created a new account based in the US, now it works as described.

from mmm-microsofttodo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.