-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Microsoft Auth Provider should support overriding client id and tenant id #115626
Comments
So will current auth provider API also allow me to authenticate via Azure DevOps app? The AzDO app requires a different app registration process as described here - https://docs.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops#register-your-app |
@ankitbko ideally, yes... but it doesn't today, as you probably know. We will be talking with the AAD team to make sure we do this correctly. |
small update in this space... I recently added a sample auth provider here: using Azure DevOps PATs has the sample. For anyone looking to interact with Azure DevOps APIs, give this sample a look and use it until we better understand the work involved to properly support AzDO in the inbox Microsoft Auth Provider. |
@TylerLeonhardt - Trying to implement my own version of the provided plugin to get aad login to work with our client id / tenant I stumbled across these lines in the codebase: vscode/extensions/microsoft-authentication/src/AADHelper.ts Lines 612 to 619 in 11a7e20
From there it seems one can in fact provide custom client and tenant ids by passing them in via the requested scopes. Giving it a quick try it seemed to work as long as the redirect url is properly configured on the application. Is this an official (yet AFAIK undocumented) feature, that can be used? |
@roeap that will be there for the foreseeable future... but I specifically haven't closed this issue as it could change in the future. |
Any news on this, please? I wanted to use a custom client_id for an OpenID authorization workflow as well |
If you find yourself overriding the client id with the Public Client (if you want to support VS Code for the desktop):
SPA (if you want to support working in VS Code for the Web aka https://vscode.dev):
|
The Microsoft Auth Provider uses a specific AAD application with client id hardcoded here:
vscode/extensions/microsoft-authentication/src/AADHelper.ts
Lines 25 to 26 in 582ea37
However, this application only has access to a handful of scopes, and to add allowed scopes to this client id is a manual process (which for an external extension author means opening an issue here and then having one of us add that scope to the allowed scopes for the application)
As an extension author, I should easily be able to create my own AAD application (in the Azure Portal for example) and use that client id instead of the one vscode uses so that I can have control over the scopes I care about and, if this exists, I can get telemetry when my client id is used.
Since we have abstracted auth providers, I think it's fitting to be able to pass additional auth provider specific options down to an auth provider. For example, the Microsoft auth provider would take a client id and tenant that would replace the hard coded string above.
Proposal:
The Auth Provider would then need to be responsible for deciding if it already has created a session with these options or if it needs to create a new session based on these options.
The text was updated successfully, but these errors were encountered: