Multiple IdentityServer Federation : Error Unable to unprotect the message.State

后端 未结 1 482
囚心锁ツ
囚心锁ツ 2021-01-18 12:18

I\'m trying to create a master slave type configuration for authentication with IdentityServer4 as below

MyMasterIdentityServer0 (Master) - receives id_token         


        
1条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 13:19

    I believe you are getting the Unable to unprotect the message.State error because one of your OIDC providers is trying to decrypt/unprotect the message state of the other one. (The message state is just a random string to help with security.)

    I suggest that you name the AuthenticationSchemes for each OIDC provider like oidc-demo and oidc-master. Then the external providers should send you back to the corresponding signin-oidc-demo and signin-oidc-master endpoints.

    --

    Turns out this answer was basically, correct. When using multiple OIDC providers you need different AuthenticationSchemes:

    AuthenticationScheme: oidc-google

    SignInScheme: IdentityServerConstants.ExternalCookieAuthenticationScheme

    Callback: /signin-oidc-google

    AND

    AuthenticationScheme: oidc-microsoft

    SignInScheme: IdentityServerConstants.ExternalCookieAuthenticationScheme

    Callback: /signin-oidc-microsoft

    If you dont't differentiate OIDC providers, they may try to sign in with the same scheme and the cryptography won't match and only the first OIDC provider registered in your code will work.

    0 讨论(0)
提交回复
热议问题