You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Assent.JWTAdapter.JOSE for Assent.Strategy.Apple, the following error occurs:
** (FunctionClauseError) no function clause matching in Assent.JWTAdapter.JOSE.jwk/2
The following arguments were given to Assent.JWTAdapter.JOSE.jwk/2:
# 1
"RS256"
# 2
nil
Attempted function clauses (showing 3 out of 3):
defp jwk(<<"HS"::binary(), _rest::binary()>>, secret)
defp jwk(_alg, key) when is_binary(key)
defp jwk(_alg, key) when is_map(key)
(assent) lib/assent/jwt_adapter/jose.ex:24: Assent.JWTAdapter.JOSE.jwk/2
(assent) lib/assent/jwt_adapter/jose.ex:46: Assent.JWTAdapter.JOSE.verify/3
(assent) lib/assent/strategies/apple.ex:108: Assent.Strategy.Apple.get_user/2
(assent) lib/assent/strategies/oauth2.ex:237: Assent.Strategy.OAuth2.fetch_user/3
(assent) lib/assent/strategies/oauth2/base.ex:69: Assent.Strategy.OAuth2.Base.callback/3
The error is caused by a nil parameter being passed for the public key in the following line:
I was able to work around the issue by providing the Apple Public Key from https://appleid.apple.com/auth/keys as a configuration parameter as follows:
def get_user(config, token) do
public_key = Config.get(config, :public_key, nil)
with {:ok, jwt} <- Helpers.verify_jwt(token["id_token"], public_key, config) do
{:ok, jwt.claims}
end
end
with the :public_key specified in my config as follows:
Hard coding the Apple public key is just a work around to get me up and running. I notice that the Ueberauth Apple strategy fetches the Apple public key during the verification phase and I guess the Assent Apple strategy should do the same?
The text was updated successfully, but these errors were encountered:
The Apple strategy does the full OAuth 2 flow so verification of the JWT isn't strictly required, but would be nice to have. I'll get back to this later. I've released v0.1.4 🚀
When using the Assent.JWTAdapter.JOSE for Assent.Strategy.Apple, the following error occurs:
The error is caused by a nil parameter being passed for the public key in the following line:
assent/lib/assent/strategies/apple.ex
Line 107 in 50f49b4
I was able to work around the issue by providing the Apple Public Key from https://appleid.apple.com/auth/keys as a configuration parameter as follows:
with the :public_key specified in my config as follows:
Hard coding the Apple public key is just a work around to get me up and running. I notice that the Ueberauth Apple strategy fetches the Apple public key during the verification phase and I guess the Assent Apple strategy should do the same?
The text was updated successfully, but these errors were encountered: