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
class Api::V1::SpreadsheetsController < Api::V1::BaseController
before_action :authenticate_user!
respond_to :json, :xlsx
def download
@records = Record.where(id: params[:token_id])
render xlsx: 'excel', filename: 'excel.xlsx', template: "spreadsheets/excel"
end
end
If I comment out :authenticate_user! in the controller, the code will open a new tab, download an xlsx file, and close as expected. If I don't comment out :authenticate_user!, devise_token_auth returns an unauthorized user error.
How do I authenticate_user in a new download tab?
The text was updated successfully, but these errors were encountered:
devise_token_auth doesn't work when opening a new tab to download a file:
Angular app with ng-token-auth
Rails api controller
If I comment out :authenticate_user! in the controller, the code will open a new tab, download an xlsx file, and close as expected. If I don't comment out :authenticate_user!, devise_token_auth returns an unauthorized user error.
How do I authenticate_user in a new download tab?
The text was updated successfully, but these errors were encountered: