Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly setting "ssoInTuneAuthUser" is broken #1466

Closed
pazepaze opened this issue Oct 31, 2024 · 5 comments · Fixed by #1502
Closed

Explicitly setting "ssoInTuneAuthUser" is broken #1466

pazepaze opened this issue Oct 31, 2024 · 5 comments · Fixed by #1502

Comments

@pazepaze
Copy link

Describe the bug
When explicitly specifying ssoInTuneAuthUser in the config, the inTune account will not be found even if it exists.

To Reproduce
Steps to reproduce the behavior:

  1. set ssoInTuneEnabled to true and ssoInTuneAuthUser to an account that exists

Expected behavior
The account is found.

Desktop:

  • OS: Ubuntu 24.04 with working InTune
  • deb Installation
  • Version 1.11.2

Debug
When setting ssoInTuneAuthUser:

09:12:17.139 › Failed to find matching InTune account for [email protected].

When only setting ssoInTuneEnabled to true and not specifying the user, so it uses the first one found:

09:58:14.080 › Using first available InTune account ([email protected])

Additional context

It seems to be a bug in this part of app/index.js:

		for (const account in response.accounts) {
			if (account.username == ssoInTuneAuthUser) {
				inTuneAccount = account;
				console.debug('Found matching InTune account (' + inTuneAccount.username + ')');
				break;
			}
		}

I will just quote our friend GitHub Copilot here:
The behavior you are observing is due to the way the processInTuneAccounts function is implemented. Here is a brief explanation:

When ssoInTuneAuthUser is specified:

  • The function iterates over the response.accounts array to find an account with a username that matches ssoInTuneAuthUser.
  • The loop uses for (const account in response.accounts), which iterates over the keys (indices) of the response.accounts array, not the actual account objects.
  • As a result, account.username is undefined, and the comparison account.username == ssoInTuneAuthUser always fails.
@IsmaelMartinez
Copy link
Owner

you need to run the intune app https://learn.microsoft.com/en-us/mem/intune/user-help/microsoft-intune-app-linux but that one is not available yet in Ubuntu.

This was a feature added by the community in #1280 , so I don't really fully know how it works tbh.

I would follow this issue in MS land but I believe this is not an issue with the app unfortunately. Good luck https://learn.microsoft.com/en-us/answers/questions/1665760/intune-portal-availability-for-ubuntu-24-04-lts

@IsmaelMartinez
Copy link
Owner

This seems to be a workaround that people use https://panther.kapsi.fi/posts/2024-09-03_ubuntu_intune

Hopefully this helps!

@pazepaze
Copy link
Author

pazepaze commented Nov 4, 2024

@IsmaelMartinez OK, but I pointed out a specific bug in app/index.js where an iteration over array indices is done instead of iterating over the values leading to account names not being found even if they exist.

The feature seems to partially work, otherwise. I am still testing this.

Just wanted to point out that specific bug.

The workaround I am using right now is to not specify a ssoInTuneAuthUser, but still setting ssoInTuneEnabled to true, so it will find the first account automatically.

@fmoessbauer
Copy link
Contributor

@IsmaelMartinez Please reopen this. The bug in https://github.com/IsmaelMartinez/teams-for-linux/blob/main/app/intune/index.js#L17 is still there. This is not related to InTune itself, but a simple logic error in the for-each loop.

fmoessbauer added a commit to fmoessbauer/teams-for-linux that referenced this issue Nov 28, 2024
We need to iterate the values, not the indexes.

closes: IsmaelMartinez#1466
@IsmaelMartinez
Copy link
Owner

IsmaelMartinez commented Nov 28, 2024

Apologies that I didn't see the error. Trying to manage that many issues sometimes makes me misunderstand issues, and or forget about them. Thanks for putting an MR @fmoessbauer . I will have a look once I get sometime (extremely busy day at work). But check you have updated the package.json file and the appmetadata (the info is in the CONTRIBUTING md file). Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants