Skip to content

Commit

Permalink
Add email claim to openid connect
Browse files Browse the repository at this point in the history
  • Loading branch information
Redande committed Dec 12, 2023
1 parent c1f0c18 commit 9178c88
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions config/initializers/doorkeeper_openid_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@

user = JSON.parse(user_response)

user_id = user['id']
user_email = User.find(resource_owner.id).email

{ id: user_id, email: user_email }.to_json
user['id']

# or if you need pairwise subject identifier, implement like below:
# Digest::SHA256.hexdigest("#{resource_owner.id}#{URI.parse(application.redirect_uri).host}#{'your_secret_salt'}")
Expand All @@ -73,4 +70,9 @@
# resource_owner.bar
# end
# end
claims do
claim :email, response: [:id_token, :user_info] do |resource_owner|
User.find(resource_owner.id).email
end
end
end

0 comments on commit 9178c88

Please sign in to comment.