问题
I am trying to trigger sending email using Keycloak API, but not succeeding. As described in documentation first I am getting token for my admin user:
curl \
-d "client_id=admin-cli" \
-d "username=admin" \
-d "password=admin" \
-d "grant_type=password" \
"http://localhost:8180/auth/realms/master/protocol/openid-connect/token"
I am successfully getting a token, which I am then using in my second call as follows:
curl -v -X PUT -d '["UPDATE_PASSWORD"]' \
-H "Content-Type: application/json" \
-H "Authorization: bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJqZEpWUW1QdEdsT3Azd0xYV2tWWVJ2ZzJXNkRubVBPSHNGQ0t5WGQ5RkVZIn0.eyJqdGkiOiIxYTI5YmJjYi04NWQ1LTRmOWQtYWRiOC0zYzA1OTZmNjJmNGMiLCJleHAiOjE1NTE5NTM5MzUsIm5iZiI6MCwiaWF0IjoxNTUxOTUzODc1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgxODAvYXV0aC9yZWFsbXMvbWFzdGVyIiwiYXVkIjoiYWRtaW4tY2xpIiwic3ViIjoiNDY2YTQwMDQtNDBmNy00NWZiLTk3ZTItODg2Mzg0NGVlOWU3IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiYWRtaW4tY2xpIiwiYXV0aF90aW1lIjowLCJzZXNzaW9uX3N0YXRlIjoiM2Q0MDZmYTEtZGJhYy00NjEwLWJiMmQtMjNiYjAyNDgxNTU2IiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlc291cmNlX2FjY2VzcyI6e30sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwibmFtZSI6IkdvaGFyIEdhc3BhcnlhbiIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwiZ2l2ZW5fbmFtZSI6IkdvaGFyIiwiZmFtaWx5X25hbWUiOiJHYXNwYXJ5YW4iLCJlbWFpbCI6ImdvaGFyLmdhc3BhcnlhbkBsZXZlcnRvbi5haSJ9.qJJ1jMs4p8V2CbtKsaVyUhWwiQur7hAwyYi14RGx5T0on6EelRNlFtduGu0XOBeB2gZ8VwuVYgmb8SGXupvJs2LfqhXMnZIy0E7y4QX0ZJQ_YH8dzAZTU6x9cJlSmFY3tTts1CF7-ySDI-ZiaKST7eVT-lkxb5fNBj2_C-6-wwOtxmctSCrQZcdKzGxf0iAYTieaGgNTJf_e6FTusvHLzFyUCAjHszV5Gw-gkzlM7R3uE9wWxjPZgkFz5zGxgKrnijZn45r0CIDQb7kKxCalBvYb-saNscpelzyHqyEd1her90UoHcLyE0JexF37Qqz040JxeJt0I1nOOADAjO8X2Q" \
"http://localhost:8180/auth/admin/realms/local/users/4553/execute-actions-email"
Answer I am getting is 404.
I figured that the problem is I am using user from user federation with an id from my database. If I create user in keycloak and use id that keycloak generated it will work.The thing is I need this functionality for federated users. Any hints?
来源:https://stackoverflow.com/questions/55041506/how-to-execute-actions-email-in-keycloak