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
29
29
var httpContext = httpContextAccessor . HttpContext ??
30
30
throw new InvalidOperationException ( "No HttpContext available from the IHttpContextAccessor!" ) ;
31
31
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 )
33
35
{
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" ) ;
36
38
37
39
request . Headers . Authorization = new ( "Bearer" , accessToken ) ;
38
40
}
You can’t perform that action at this time.
0 commit comments