Skip to content

feat: Generalize Azure AD support #629

@cjam

Description

@cjam

In your current offering of AzureAD support it assumes that the domain is always going to be login.microsoftonline.com as per usage here:

azuread: {
grant: {
oauth: 2,
scope_delimiter: ' ',
client_id: process.env.AUTH_PROVIDER_AZUREAD_CLIENT_ID,
client_secret: process.env.AUTH_PROVIDER_AZUREAD_CLIENT_SECRET,
authorize_url: `${azureBaseUrl}/[subdomain]/oauth2/authorize`,
custom_params: {
prompt: 'select_account',
},
access_url: `${azureBaseUrl}/[subdomain]/oauth2/token`,
profile_url: `${azureBaseUrl}/[subdomain]/openid/userinfo`,
subdomain: process.env.AUTH_PROVIDER_AZUREAD_TENANT || 'common',
dynamic: [],
},
profile: ({ jwt }) => {
const payload = jwt?.id_token?.payload;
return {
id: payload.oid,
displayName: payload.name,
email: payload.email,
};
},
},

My application (nodejs) uses passport-azure-oauth2, which leverages the passport oauth strategy and leaves the base urls as configurable, which allows the library to be used with any azure AD product, in my case Azure b2c which uses a different tenant-based domain entirely.

https://github.com/AndrewKeig/passport-azure-oauth2/blob/85dda56f3b5a71759f7e1995f20fdfe49ec722e1/lib/index.js#L6-L24

It would be great to be able to pass additional configuration to override the base urls / issues / audience that are used in constructing the azure oauth2 flows. Happy to provide additional code if it's helpful.

Originally posted by @cjam in #625 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions