Created
July 2, 2018 12:14
-
-
Save skycocker/4c91223d3e5c74b5782c97fc09951749 to your computer and use it in GitHub Desktop.
Add Location header clone for Alamofire + devise_token_auth password reset flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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