[PR #3138] [MERGED] fix: Self-host unable to use Azure oauth #4246

Closed
opened 2026-03-17 01:48:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/3138
Author: @domestic-fennec
Created: 6/14/2023
Status: Merged
Merged: 6/22/2023
Merged by: @AndrewBastin

Base: release/2023.4.7Head: fix/GH-3050


📝 Commits (2)

  • 472f7ba fix: Self-host unable to use Azure oauth
  • 13030ed feat: allow azure tenant to be specified for microsoft auth

📊 Changes

2 files changed (+2 additions, -1 deletions)

View changed files

📝 .env.example (+1 -0)
📝 packages/hoppscotch-backend/src/auth/strategies/microsoft.strategy.ts (+1 -1)

📄 Description

Closes #3050 #3139

Description (bugfix)

The passReqToCallback=true alters the arguments passed to MicrosoftStrategy.validate such that first argument is a request object and other arguments are shifted across one. This meant that actual values for accessToken and critically profile weren't in the expected arguments and therefore the rest of the method would break. I believe passReqToCallback was added in error in 81cb0d43d7. This method could never work in it's current form with this option set to true.

This has been tested (and previously debugged) on a private instance of hopscotch so I can confirm that this method does now indeed work in "production"

Description (feature)

Many orgs using Azure AD will be running on their own "tenants" rather than the "common" tenant, and therefore need to be able to specify a tenant ID to allow oauth2 url's to be correctly generated by passport-microsoft. This change allows setting the tenant ID as the MICROSOFT_TENANT env var.

See passportjs.org/packages/passport-microsoft for more detail.

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information

none


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/3138 **Author:** [@domestic-fennec](https://github.com/domestic-fennec) **Created:** 6/14/2023 **Status:** ✅ Merged **Merged:** 6/22/2023 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `release/2023.4.7` ← **Head:** `fix/GH-3050` --- ### 📝 Commits (2) - [`472f7ba`](https://github.com/hoppscotch/hoppscotch/commit/472f7bab494216d3306d170fd91d4c86e9ce4fb8) fix: Self-host unable to use Azure oauth - [`13030ed`](https://github.com/hoppscotch/hoppscotch/commit/13030ed6b1ce18cf071a7717cdc7669b24f02db8) feat: allow azure tenant to be specified for microsoft auth ### 📊 Changes **2 files changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+1 -0) 📝 `packages/hoppscotch-backend/src/auth/strategies/microsoft.strategy.ts` (+1 -1) </details> ### 📄 Description Closes #3050 #3139 ### Description (bugfix) The `passReqToCallback=true` alters the arguments passed to `MicrosoftStrategy.validate` such that first argument is a `request` object and other arguments are shifted across one. This meant that actual values for `accessToken` and critically `profile` weren't in the expected arguments and therefore the rest of the method would break. I believe `passReqToCallback` was added in error in 81cb0d43d78e41a3ce1e82260a10fa9baedfbc64. This method could never work in it's current form with this option set to true. This has been tested (and previously debugged) on a private instance of hopscotch so I can confirm that this method does now indeed work in "production" ### Description (feature) Many orgs using Azure AD will be running on their own "tenants" rather than the "common" tenant, and therefore need to be able to specify a tenant ID to allow oauth2 url's to be correctly generated by passport-microsoft. This change allows setting the tenant ID as the `MICROSOFT_TENANT` env var. See passportjs.org/packages/passport-microsoft for more detail. ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [x] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [x] All the tests have passed ### Additional Information none --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:48:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4246
No description provided.