rubymotion-community / motion-authentication Goto Github PK
View Code? Open in Web Editor NEWA simple, standardized authentication helper for common authentication strategies for RubyMotion apps.
License: MIT License
A simple, standardized authentication helper for common authentication strategies for RubyMotion apps.
License: MIT License
I am having issues with setting .current_user
When first signing in, everything works fine. However, if the application starts with a user previously logged in, and therefore Auth.signed_in? = true, then Auth.current_user must be set as it is currently false.
I check for this and set it in app_delegate:
app_delegate.rb
def on_load(app, options)
if Auth.signed_in?
ApiClient.update_authorization_header(Auth.authorization_header)
if Auth.current_user.nil?
set_current_user
mp Auth.current_user # evaluates to nil !!!
end
open_authenticated_root
else
open SignInScreen.new(nav_bar: true)
end
end
def open_authenticated_root
open_tab_bar MatchesScreen.new(nav_bar: true), MatchTemplatesScreen.new(nav_bar: true)
end
def set_current_user
ApiClient.client.get "user" do |response|
if response.success?
Auth.current_user = User.new(response.object["data"])
else
app.alert "Please sign in again"
open SignInScreen.new(nav_bar: true)
end
end
end
The problem is that despite setting Auth.current_user this way, it is always nil when evaluating right away and is also nil in the authenticated_root screen. It does return the User object just fine in the REPL though. I don't know what I'm doing wrong.
Hi. I have forked this repo to use it in my project and notice that the current devise_token_auth strategy does not match the current version (v 0.1.37) of the devise_token_auth gem.
User and Email parameters are POSTed to sign_in url but should not be wrapped in a user hash.
Response will include access-token, uid and client field as Header responses, not as fields in the JSON body.
I think this version may be deprecated?
I will make the necessary updates and send a PR if you're interested in updating this. It's certainly a very useful library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.