Skip to content

Instantly share code, notes, and snippets.

@skycocker
Created July 2, 2018 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skycocker/4c91223d3e5c74b5782c97fc09951749 to your computer and use it in GitHub Desktop.
Save skycocker/4c91223d3e5c74b5782c97fc09951749 to your computer and use it in GitHub Desktop.
Add Location header clone for Alamofire + devise_token_auth password reset flow
class Auth::PasswordsController < DeviseTokenAuth::PasswordsController
def edit
super
# Alamofire tends to ignore Location header in .allHeaderFields, blindly following its contents instead
# so we add a new header with the same value
# in order to parse it in mobile app
response.headers['Alamofire-Location'] = response.headers['Location']
end
end
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
passwords: 'auth/passwords',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment