File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 77@using Microsoft .AspNetCore .Localization
88@using Microsoft .Net .Http .Headers
99@using Microsoft .Extensions .Primitives
10+ @using Microsoft .AspNetCore .Authentication
1011@using Oqtane .Client
1112@using Oqtane .UI
1213@using Oqtane .Repository
177178 // get jwt token for downstream APIs
178179 if (Context .User .Identity .IsAuthenticated )
179180 {
180- GetJwtToken (alias );
181+ await GetJwtToken (alias );
181182 }
182183
183184 // includes resources
444445 }
445446 }
446447
447- private void GetJwtToken (Alias alias )
448+ private async Task GetJwtToken (Alias alias )
448449 {
449- _authorizationToken = Context .Request .Headers [HeaderNames .Authorization ];
450- if (! string .IsNullOrEmpty (_authorizationToken ))
451- {
452- // bearer token was provided by remote Identity Provider and was persisted using SaveTokens
453- _authorizationToken = _authorizationToken .Replace (" Bearer " , " " );
454- }
455- else
450+ // bearer token may have been provided by remote Identity Provider and persisted using SaveTokens = true
451+ _authorizationToken = await Context .GetTokenAsync (" access_token" );
452+ if (string .IsNullOrEmpty (_authorizationToken ))
456453 {
457454 // generate bearer token if a secret has been configured in User Settings
458455 var sitesettings = Context .GetSiteSettings ();
You can’t perform that action at this time.
0 commit comments