File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
EasyAuth.ContainerApp/Services Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -49,14 +49,22 @@ public async Task<string> GetPayload()
4949
5050 public async Task < string > GetAuthMe ( )
5151 {
52+ var context = accessor . HttpContext ;
53+ var request = context ! . Request ;
54+ var headers = request . Headers ;
5255 var authMe = default ( string ) ;
5356 try
5457 {
55- authMe = await http . GetStringAsync ( "/.auth/me" ) ;
58+ http . DefaultRequestHeaders . Clear ( ) ;
59+ foreach ( var header in headers )
60+ {
61+ http . DefaultRequestHeaders . Add ( header . Key , header . Value . ToArray ( ) ) ;
62+ }
63+ authMe = JsonSerializer . Serialize ( await http . GetFromJsonAsync < object > ( "/.auth/me" ) , options ) ;
5664 }
57- catch
65+ catch ( Exception ex )
5866 {
59- authMe = "Not authenticated" ;
67+ authMe = ex . Message ;
6068 }
6169
6270 return authMe ;
Original file line number Diff line number Diff line change @@ -49,14 +49,22 @@ public async Task<string> GetPayload()
4949
5050 public async Task < string > GetAuthMe ( )
5151 {
52+ var context = accessor . HttpContext ;
53+ var request = context ! . Request ;
54+ var headers = request . Headers ;
5255 var authMe = default ( string ) ;
5356 try
5457 {
55- authMe = await http . GetStringAsync ( "/.auth/me" ) ;
58+ http . DefaultRequestHeaders . Clear ( ) ;
59+ foreach ( var header in headers )
60+ {
61+ http . DefaultRequestHeaders . Add ( header . Key , header . Value . ToArray ( ) ) ;
62+ }
63+ authMe = JsonSerializer . Serialize ( await http . GetFromJsonAsync < object > ( "/.auth/me" ) , options ) ;
5664 }
57- catch
65+ catch ( Exception ex )
5866 {
59- authMe = "Not authenticated" ;
67+ authMe = ex . Message ;
6068 }
6169
6270 return authMe ;
You can’t perform that action at this time.
0 commit comments