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
{{ message }}
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.
Our app is making native, authenticated web requests via NSURLSession as explained in the Authentication wiki to a Rails backend. To get any of these JSON requests to work we need to disable CSRF protection via skip_before_action :verify_authenticity_token.
Is this "OK" or are we opening up ourselves to a potential attack?
If not, is there a better way to authorize these network requests coming from iOS?
Thanks for the help!
The text was updated successfully, but these errors were encountered:
Our apps all use OAuth tokens for any native API requests. Then, we disable CSRF protection in Rails only for requests that are authenticated with OAuth and keep CSRF enabled for all web requests.
Thanks for the reply! I have two follow up questions:
Is OAuth done via a user flow? Or doe the client and server authenticate with each other for each session?
How does the initial request work? Isn't that done before the client has authenticated and presumably before any OAuthing has been done? My assumption is that CSRF would need to be disabled for that and no OAuth present.
Our authentication is all done natively. We have a native, standard OAuth flow for signing in and get OAuth tokens back. The native app then authenticates the web view with the OAuth tokens, and we've taken two different approaches there, both work. 1) Load a request in the web view with the OAuth token to an endpoint that authenticates the user and sets the right cookies from the server, or 2) return the cookies along with the OAuth request, and the app manually sets those cookies to the web view's cookie store
Our app is making native, authenticated web requests via
NSURLSession
as explained in the Authentication wiki to a Rails backend. To get any of these JSON requests to work we need to disable CSRF protection viaskip_before_action :verify_authenticity_token
.Thanks for the help!
The text was updated successfully, but these errors were encountered: