Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/controllers/users/orcid_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def auto_update_auth
ENV["ORCID_AUTO_UPDATE_REDIRECT_URI"],
SCOPES_AUTO_UPDATE.join(" "))

logger.info "AUTH URL: #{auth_url}"
redirect_to auth_url
end

Expand All @@ -28,9 +29,13 @@ def auto_update_callback

@user = User.from_orcid(response[:id])

logger.info "User (before update): #{@user.inspect}"
logger.info "access token: #{@user.orcid_auto_update_access_token}"
@user.update(orcid_auto_update_access_token: response[:access_token],
orcid_auto_update_refresh_token: response[:refresh_token],
orcid_auto_update_expires_at: response[:expires_at])
logger.info "User (after update): #{@user.inspect}"
logger.info "access token: #{@user.orcid_auto_update_access_token}"

redirect_to stored_location_for(:user) || setting_path("me")
end
Expand Down Expand Up @@ -68,6 +73,7 @@ def search_and_link_auth
ENV["ORCID_SEARCH_AND_LINK_REDIRECT_URI"] + "?redirect_to_commons=false",
SCOPES_SEARCH_AND_LINK.join(" "))

logger.info "AUTH URL: #{auth_url}"
redirect_to auth_url
end

Expand All @@ -80,9 +86,13 @@ def search_and_link_callback

@user = User.from_orcid(response[:id])

logger.info "User (before update): #{@user.inspect}"
logger.info "access token: #{@user.orcid_search_and_link_access_token}"
@user.update(orcid_search_and_link_access_token: response[:access_token],
orcid_search_and_link_refresh_token: response[:refresh_token],
orcid_search_and_link_expires_at: response[:expires_at])
logger.info "User (after update): #{@user.inspect}"
logger.info "access token: #{@user.orcid_search_and_link_access_token}"

# Redirect to Commons if the flag isn't explicitly false. Otherwise redirect to profile settings
if params["redirect_to_commons"] != "false"
Expand Down