File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Catglobe.CgScript.Runtime Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,12 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
2929 var httpContext = httpContextAccessor . HttpContext ??
3030 throw new InvalidOperationException ( "No HttpContext available from the IHttpContextAccessor!" ) ;
3131
32- if ( httpContext . User . Identity ? . IsAuthenticated == true )
32+ string ? accessToken = null ;
33+ if ( ( httpContext . Items . TryGetValue ( "access_token" , out var accessTokenObj ) && accessTokenObj is string accessToken2 ) ) accessToken = accessToken2 ;
34+ if ( ! string . IsNullOrEmpty ( accessToken ) || httpContext . User . Identity ? . IsAuthenticated == true )
3335 {
34- var accessToken = await httpContext . GetTokenAsync ( "access_token" ) ??
35- throw new InvalidOperationException ( "No access_token was saved" ) ;
36+ accessToken ?? = await httpContext . GetTokenAsync ( "access_token" ) ??
37+ throw new InvalidOperationException ( "No access_token was saved" ) ;
3638
3739 request . Headers . Authorization = new ( "Bearer" , accessToken ) ;
3840 }
You can’t perform that action at this time.
0 commit comments