I'm basically trying to pass the token
stored in Preferences to the turbo fragment. I figured that being stored, it would be usable in the fragments.
Are there any tutorials on how this is done? I'm not that well versed in android.
For ios => this they say:
"For HEY, we have a slightly different approach. We get the cookies back along with our initial OAuth request and set those cookies directly to the web view and global cookie stores"
How exactly to you set the token/cookies to the web view
and is android Preferences
the same as ios global cookie store
?
Much appreciated help!
UPDATE:
Thanks to @yungindigo the answer below it works! I had to modify my way because I have my token stored in a different table but what I used for my application is:
User.rb
has_many :oauth_tokens, dependent: :destroy
OauthToken.rb
belongs_to :user
application_helper.rb
def auth_mobile_user
token = cookies[:oauth_token]
oauth = OauthToken.find_by_oauth_token(token)
session[:user_id] = oauth.user.id
end
application.html.erb
<% unless mobile? %>
<%= render 'layouts/header' %>
<% else %>
<% auth_mobile_user %>
<% end %>
The mobile?
method just checks the header
for name that I assign in the user_agent
from android so the app knows if its from a mobile app or web app.