-
Notifications
You must be signed in to change notification settings - Fork 445
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
Add support for Microsoft Identity Platform aka Azure ActiveDirectory V2 #649
Conversation
Apparently I have a lot of linting issues to fix :-) |
@darrelmiller merged, thanks 😄 |
@darrelmiller @luismanez @henriksen @dannmartens @rgregg @marcoscheel you can try the latest version 0.24.2 to verify it |
I've tried it (the example calls provided, verbatim), after upgrading to v0.24.2 and I can't get it to work, unfortunately. I've tested with a REST client environment, and with direct parameters between double brackets. At no point did I get a user prompt. Same for "appOnly," with the client secret set. I'm using parameter names, such as "tenantId, clientId and clientSecret." For the tenantId, I am using the actual domain. I checked the source code and found the environment variables are "aadV2TenantId, aadV2ClientId and aadV2ClientSecret," but it made no difference when I used those. All the responses look like this: HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: application/json
request-id: 815815a4-1942-4514-83e3-603a26bc781c
client-request-id: 815815a4-1942-4514-83e3-603a26bc781c
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"North Europe","Slice":"SliceC","Ring":"4","ScaleUnit":"001","RoleInstance":"AGSFE_IN_9"}}
WWW-Authenticate: Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize", client_id="00000003-0000-0000-c000-000000000000"
Strict-Transport-Security: max-age=31536000
Date: Sun, 30 Aug 2020 11:56:08 GMT
Connection: close
Content-Length: 265
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken parsing failed with error code: 80049217",
"innerError": {
"date": "2020-08-30T11:56:08",
"request-id": "815815a4-1942-4514-83e3-603a26bc781c"
}
}
} If the returned client Id is something to go by, it seems my parameter values are not getting picked up. I might be doing something wrong, but I am at a loss here. Can you document the actual parameter name combos, which are known to work? |
@darrelmiller could you please take a look at @dannmartens issue? |
I got it working, but I had to ask with a scope one time first. The minimal call did not work at first. I would get a permission denied error. But after using a scope once and consenting to it, then it works fine, both with and without the scope. |
@henriksen By default all apps created in Azure AD are given consent to User.Read scope from Microsoft Graph by default. Accessing anything else will require providing a scope parameter to trigger the consent dialog. Once you have consented the application to that scope, you don't need the scope parameter anymore. @dannmartens Try using Probably would be a good idea if I make the appUri value a bit more tolerant because everyone makes a mistake on this. I also had some issues with whether the final slash should be percent encoded. |
@henriksen I think I may have figured out why the call without the scope didn't work. Ignore everything I said about getting User.Read by default. You don't get that default because I did another workaround to avoid a different AADV2 bug. |
And sadly, scopes need to be capitalized properly. e.g. User.Read. I will create fix for that. |
@darrelmiller Thanks for looking into this! I would like to solicit for your opinion: do you think it is necessary to have the parameter names prefixed with "aadV2?" It seems to complicate configuration more than is necessary. Are there any cases where this would cause naming issues with the original AADToken? Typical configuration values I use for the different IAM flows are:
Values in scopes can be:
|
Following in the footsteps of the excellent
aadToken
system variable, this PR adds an aadV2Token that makes it easy to use the OAuth2 compliant AzureAD V2 endpoints. I specifically created this to make it easy to call the Microsoft Graph API.Feedback welcome. This is my first time writing any non-trivial amount of TypeScript so there may be some horrible C# looking things in there.