Skip to content

Commit c5f0faf

Browse files
danhalsonCopilot
andauthored
Add fallback in the unlikely scenario error_description doesn't exist
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3120f1c commit c5f0faf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/controllers/api/google_auth_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def exchange_code
3030
if response.success?
3131
render :exchange_code, status: :ok
3232
else
33-
render json: { error: @token_response['error_description'] }, status: :unauthorized
33+
error_message = @token_response['error_description'] || @token_response['error'] || 'Unknown error'
34+
render json: { error: error_message }, status: :unauthorized
3435
end
3536
rescue Faraday::Error => e
3637
render json: { error: e.message }, status: :service_unavailable

0 commit comments

Comments
 (0)