Skip to content

Commit 1989897

Browse files
Added redirect-uri option (#403)
Co-authored-by: Shane Weaver <[email protected]>
1 parent a52538d commit 1989897

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<mgt-msal-provider
2727
client-id="a974dfa0-9f57-49b9-95db-90f04ce2111a"
2828
scopes="user.read,people.read,user.readbasic.all,contacts.read,calendars.read"
29+
redirect-uri="http://localhost:3000"
2930
depends-on="mgt-teams-provider"
3031
></mgt-msal-provider>
3132

src/components/providers/mgt-msal-provider.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ export class MgtMsalProvider extends MgtBaseProvider {
5959
})
6060
public scopes;
6161

62+
/**
63+
* The redirect uri to use
64+
*
65+
* @memberof MgtMsalProvider
66+
*/
67+
@property({
68+
attribute: 'redirect-uri',
69+
type: String
70+
})
71+
public redirectUri;
72+
6273
/**
6374
* Gets whether this provider can be used in this environment
6475
*
@@ -99,6 +110,10 @@ export class MgtMsalProvider extends MgtBaseProvider {
99110
}
100111
}
101112

113+
if (this.redirectUri) {
114+
config.redirectUri = this.redirectUri;
115+
}
116+
102117
this.provider = new MsalProvider(config);
103118
Providers.globalProvider = this.provider;
104119
}

src/providers/MsalProvider.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export interface MsalConfig {
4747
*/
4848
loginType?: LoginType;
4949
/**
50-
* options
50+
* options as defined in
51+
* https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options
5152
*
5253
* @type {Configuration}
5354
* @memberof MsalConfig
@@ -60,6 +61,13 @@ export interface MsalConfig {
6061
* @memberof MsalConfig
6162
*/
6263
loginHint?: string;
64+
/**
65+
* redirect Uri
66+
*
67+
* @type {string}
68+
* @memberof MsalConfig
69+
*/
70+
redirectUri?: string;
6371
}
6472

6573
/**
@@ -343,6 +351,10 @@ export class MsalProvider extends IProvider {
343351
msalConfig.auth.authority = config.authority;
344352
}
345353

354+
if (config.redirectUri) {
355+
msalConfig.auth.redirectUri = config.redirectUri;
356+
}
357+
346358
this.clientId = config.clientId;
347359

348360
this._userAgentApplication = new UserAgentApplication(msalConfig);

0 commit comments

Comments
 (0)