The easiest way is to have a long session on the server side, but
not sure if it is safe for the browser version. I would rather implicitly re
if the session expires, then Login, but in this case, I have to deal with the session
expiration, send a new login request, receive the response and send
again the target request. The source becomes more complicated.
Is there any function in RestKit that allows management
automatically? Maybe just keep a persistent session for the iPhone application
The web version using CakePHP function is short?
Thank you,
winner
I am currently developing a RestKit project on iOS. According to my needs, what I have done is very close to the discussion board example of the creator of RestKit.
In iOS, You can write uniqueSecurityToken for NSUserDefaults. It can be an attribute model of user model on iOS app. On Rails (I made an assumption), if you have an auth gem like Authlogic/Sorcery, it is easy to override the current_user method Or assign a method based on the token.
For example,
def user_access_token
request.headers["HTTP_X_USER_ACCESS_TOKEN"] || request.headers[ "HTTP_USER_ACCESS_TOKEN"]
end
def check_for_mobile_token
if token = user_access_token
current_user = User.find_by_remember_me_token(token) || current_user
end
end
You can call the before filter to ensure that authentication is always checked. On the IOS side, tell RestKit to send the uniqueSecurityToken as HTTP_USER_ACCESS_TOKEN in the header file. Please note that this may not be the most secure method, you At least HTTPS should be used for encrypted transmission.
This is a RestKit discussion board project (very useful for RestKit/IOS)
https://github.com/RestKit/RKDiscussionBoard
This is a Rails presentation that outlines Rails/iOS integration
http://www.slideshare.net/maximeguilbot/rails-as-ios-application-backend
If you are using other than Rails Other REST frameworks, then you can also quote JSON technology.
Use RestKit for ” What is the correct way to persist” sessions?
The easiest way is to have a long session on the server side, but
not sure if it is safe for the browser version. I would rather implicitly re
if the session expires, then Login, but in this case, I have to deal with the session
expiration, send a new login request, receive the response and send
again the target request. The source becomes more complicated.
Is there any function in RestKit that allows management
automatically? Maybe just keep a persistent session for the iPhone application
The web version using CakePHP function is short?
Thank you,
Winner
You may want the conversation so that authentication/authorization works?
I am currently developing a RestKit project on iOS. According to my needs, what I have done is very close to the discussion board example of the creator of RestKit.
In iOS, You can write uniqueSecurityToken for NSUserDefaults. It can be an attribute model of user model on iOS app. On Rails (I made an assumption), if you have an auth gem like Authlogic/Sorcery, it is easy to override the current_user method Or assign a method based on the token.
For example,
def user_access_token
request.headers["HTTP_X_USER_ACCESS_TOKEN"] || request.headers[ "HTTP_USER_ACCESS_TOKEN"]
end
def check_for_mobile_token
if token = user_access_token
current_user = User.find_by_remember_me_token(token) || current_user
end
end
You can call the before filter to ensure that authentication is always checked. On the IOS side, tell RestKit to send the uniqueSecurityToken as HTTP_USER_ACCESS_TOKEN in the header file. Please note that this may not be the most secure method, you At least HTTPS should be used for encrypted transmission.
This is a RestKit discussion board project (very useful for RestKit/IOS)
https://github.com/RestKit/RKDiscussionBoard
This is a Rails presentation that outlines Rails/iOS integration
http://www.slideshare.net/maximeguilbot/rails-as-ios-application-backend
If you are using other than Rails Other REST frameworks, then you can also use JSON technology.