Using the Maui WebAuthenticator to complete apple signin, when returned back to the api website the following error below appears. I am able to sucessfully redirect back from Apple and during code-step through i can see that my Apple PrivateKey is loaded into memory. However, after completing the apple signin process I get this message upon return back from apple to https://api.whittaker.ca/signin-apple

ArgumentException: No supported key formats were found. Check that the input represents the contents of a PEM-encoded key file, not the path to such a file. (Parameter 'input')
System.Security.Cryptography.PemKeyHelpers.ImportPem(ReadOnlySpan<char> input, FindImportActionFunc callback)

Exception: An error was encountered while handling the remote login.
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()

Stack Query Cookies Headers Routing
ArgumentException: No supported key formats were found. Check that the input represents the contents of a PEM-encoded key file, not the path to such a file. (Parameter 'input')
System.Security.Cryptography.PemKeyHelpers.ImportPem(ReadOnlySpan<char> input, FindImportActionFunc callback)
AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.CreateAlgorithm(ReadOnlyMemory<char> pem)
AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.GenerateNewSecretAsync(AppleGenerateClientSecretContext context)
AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator+<>c__DisplayClass5_0+<<GenerateAsync>b__0>d.MoveNext()
Microsoft.Extensions.Caching.Memory.CacheExtensions.GetOrCreateAsync<TItem>(IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory)
AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.GenerateAsync(AppleGenerateClientSecretContext context)
AspNet.Security.OAuth.Apple.AppleAuthenticationEvents+<>c+<<-ctor>b__10_0>d.MoveNext()
AspNet.Security.OAuth.Apple.AppleAuthenticationEvents.GenerateClientSecret(AppleGenerateClientSecretContext context)
AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.ExchangeCodeAsync(OAuthCodeExchangeContext context)
AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.HandleRemoteAuthenticateAsync(Dictionary<string, StringValues> parameters)
AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.HandleRemoteAuthenticateAsync()
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()

Show raw exception details
System.ArgumentException: No supported key formats were found. Check that the input represents the contents of a PEM-encoded key file, not the path to such a file. (Parameter 'input')
   at System.Security.Cryptography.PemKeyHelpers.ImportPem(ReadOnlySpan`1 input, FindImportActionFunc callback)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.CreateAlgorithm(ReadOnlyMemory`1 pem)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.GenerateNewSecretAsync(AppleGenerateClientSecretContext context)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.<>c__DisplayClass5_0.<<GenerateAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Caching.Memory.CacheExtensions.GetOrCreateAsync[TItem](IMemoryCache cache, Object key, Func`2 factory)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.GenerateAsync(AppleGenerateClientSecretContext context)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationEvents.<>c.<<-ctor>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at AspNet.Security.OAuth.Apple.AppleAuthenticationEvents.GenerateClientSecret(AppleGenerateClientSecretContext context)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.ExchangeCodeAsync(OAuthCodeExchangeContext context)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.HandleRemoteAuthenticateAsync(Dictionary`2 parameters)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.HandleRemoteAuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
Exception: An error was encountered while handling the remote login.
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Show raw exception details
System.Exception: An error was encountered while handling the remote login.
 ---> System.ArgumentException: No supported key formats were found. Check that the input represents the contents of a PEM-encoded key file, not the path to such a file. (Parameter 'input')
   at System.Security.Cryptography.PemKeyHelpers.ImportPem(ReadOnlySpan`1 input, FindImportActionFunc callback)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.CreateAlgorithm(ReadOnlyMemory`1 pem)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.GenerateNewSecretAsync(AppleGenerateClientSecretContext context)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.<>c__DisplayClass5_0.<<GenerateAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Caching.Memory.CacheExtensions.GetOrCreateAsync[TItem](IMemoryCache cache, Object key, Func`2 factory)
   at AspNet.Security.OAuth.Apple.Internal.DefaultAppleClientSecretGenerator.GenerateAsync(AppleGenerateClientSecretContext context)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationEvents.<>c.<<-ctor>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at AspNet.Security.OAuth.Apple.AppleAuthenticationEvents.GenerateClientSecret(AppleGenerateClientSecretContext context)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.ExchangeCodeAsync(OAuthCodeExchangeContext context)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.HandleRemoteAuthenticateAsync(Dictionary`2 parameters)
   at AspNet.Security.OAuth.Apple.AppleAuthenticationHandler.HandleRemoteAuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)```

0

There are 0 best solutions below