When I refresh the page, I get logged out.
https://blooming-plateau-98618.herokuapp.com/
Sorry to make you register to see the error. It's just a fresh install of MeanJS https://github.com/meanjs/generator-meanjs
I get no errors when I "inspect page" and hit "console." I also am not seeing anything in the heroku logs.
I found out the error was with beautify'ing the code. It separated this important line
var user = {{user | json | safe}};
Related
I am getting errors when reloading the previously opened tab of my Laravel Project on my browser. There is no error on the page, I mean it loads correctly when I opened it half hour ago.
The error says "Trying to get property of non-object"
4/4 ErrorException
Trying to get property of non-object
(View: C:\xampp\htdocs\demo\resources\views\partials\mainheader.blade.php)
(View: C:\xampp\htdocs\demo\resources\views\partials\mainheader.blade.php)
(View: C:\xampp\htdocs\demo\resources\views\partials\mainheader.blade.php)
ADDED: Only suspicious code that might be causing problem on mainheader.blade.php is, I am using {{ Auth::user()->name }}. But I am still confuse how I can Redirect this exception.
What I thought was, it was due to error in session and token expiration, so I added this code to app/Exception/handler.php
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
return redirect('error/403')->withErrors(['token_error' => 'Sorry, your session seems to have expired. Please try again.']);
}
But, that was not solved. Could you please so me the right way?
Found my mistake. Actually it was on the route, I should have added middleware for Auth.
Route::get('/home', ['middleware' => 'auth', function () {
return view('home');
}]);
Now, that's good and working.
I am using Google OAuth for Google signin with Odoo.
Everything works fine and I can sign in using google with no problem. However, I cannot open multiple sessions using my same google credentials.
For example, if I open two sessions, one in chrome and another in firefox, then the older session gets logged out.
I don't understand what's the problem because no matter how many sessions I start if I log in using my username and password separately, without using google OAuth, none of the sessions get logged out - works fine.
I was wondering it has got something to do with the code, so I did a lot of tweaks but nothing works. I saw that at one point it cannot get the session information of older sessions. However my question is not about the code.
My question is, is there any configuration or setting to be set in google OAuth or Odoo 8 which lets users have multiple sessions at the same time or is there any setting while using google OAuth with Odoo that I need to know for this?
Any idea would be really helpful as I've been struggling for days with this. Thanks!
I have build a module for Odoo V9. Without this module, Odoo save only one token. But when you use odoo in multi computer, you use one token for each computer.
By default odoo don't support multi token. You need to modify the code of module auth_oauth.
With this module it save all token, like that you can have multi connection.
You can donwload and instal this module : https://github.com/IguanaYachts/auth_oauth_multi_token.git
class ResUsers(models.Model):
_inherit = 'res.users'
oauth_access_token_ids = fields.One2many('auth.oauth.multi.token', 'user_id', 'Tokens', copy=False)
oauth_access_max_token = fields.Integer('Number of simultaneous connections', default=5, required=True)
#api.model
def _auth_oauth_signin(self, provider, validation, params):
res = super(ResUsers, self)._auth_oauth_signin(provider, validation, params)
oauth_uid = validation['user_id']
user_ids = self.search([('oauth_uid', '=', oauth_uid), ('oauth_provider_id', '=', provider)]).ids
if not user_ids:
raise openerp.exceptions.AccessDenied()
assert len(user_ids) == 1
self.oauth_access_token_ids.create({'user_id': user_ids[0],
'oauth_access_token': params['access_token'],
'active_token': True,
})
return res
#api.multi
def clear_token(self):
for users in self:
for token in users.oauth_access_token_ids:
token.write({
'oauth_access_token': "****************************",
'active_token': False})
#api.model
def check_credentials(self, password):
try:
return super(ResUsers, self).check_credentials(password)
except openerp.exceptions.AccessDenied:
res = self.env['auth.oauth.multi.token'].sudo().search([
('user_id', '=', self.env.uid),
('oauth_access_token', '=', password),
('active_token', '=', True),
])
if not res:
raise
If you follow the steps above you will be able to successfully configure Google Apps (Gmail) with OpenERP via the OAuth module. The only thing i was missing is an extra step I found in a youtube video; you have to:
Go to Settings - Users
To the users you want to give OAuth access, send them a password reset by using the "Send reset password instructions by email" option.
Ask your users (or yourself) to use the link they receive in their email, but, when they open it, they will only see the log in screen with the "Log in with Google" option. (no typical change password option available)
Use the proper Google account and voila! - Now it connects smoothly.
The Youtube video that show how to log in with Google in OpenERP: http://www.youtube.com/watch?v=A-iwzxEeJmc
and if configuration of Oauth2 and odoo see this link for more detail
https://odootricks.wordpress.com/2014/09/18/setting-up-google-apps-authentication-for-odoo/
I'm using Grails 2.1.1 with Cucumber and Geb. I have an Auth.feature that contains 2 scenarios. One is for authenticating successfully and the other is for testing invalid credentials.
The way I think I have to work this out is to have geb log out the user from the first scenario before it can run the second scenario. This is because my Given step checks to make sure I'm at the login page. After scenario 1 executes, I'm on a Dashboard page.
I guess my question is do I (a) use geb to sign out the valid user before completing the scenario or (b) is there a way to have it start over between scenarios?
Right now, I've implemented (a) and it works just fine. Just want to know if this is optimal.
Here is my feature
Feature: login to system
As a user of the system
I want to log in to the application
so that I can use it
Scenario: login
Given I access the login page
When I enter valid credentials
Then I see the dashboard
Scenario: auth fail
Given I access the login page
When I enter invalid credentials
Then I see appropriate error messages
And here is my Geb steps
Given(~'^I access the login page$') {->
to LoginPage
at LoginPage
}
When(~'^I enter valid credentials$') {
page.add('user_10001#test.com', '10001')
}
Then(~'^I see the dashboard$') {->
at DashboardPage
}
Then(~'^I see an error message on the login page$') { ->
at LoginPage
}
When(~'^I enter invalid credentials$') { ->
page.add('baduser', 'paddpassword')
}
Then(~'^I see appropriate error messages$') { ->
at LoginPage
// check for error message
}
Based on some more research I've done, it looks like there are a few ways to handle this:
Just like I am already doing it, by logging out at the end of a scenario (or you could do it at the beginning
Make logging out its own scenario
In the env.groovy Before hook, add to LogoutPage
Logout using a Background
Add the following line to the After hook in env.groovy:
bindingUpdater.browser.clearCookies()
I'm trying to authenticate users coming to my site from a click on an opengraph action in facebook.
I've generate the action successfully with the following code. This
goes out to my timeline successfully. So far, so good.
require 'cgi'
client_id ="CLIENT_ID"
client_secret = "CLIENT_SECRET"
recipe = "http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice"
access_token = "LONGACCESSTOKEN"
# PUBLISH
result = `curl -F access_token=#{access_token} -F recipe=#{recipe} https://graph.facebook.com/me/foodonthetable_mrh:plan_to_cook`
puts result
When I click on the link in the timeline, I'm taken to the following URL. This is where
I start having issues. Basically, I want to recognize the user coming in
through this link and log them in (or create a new user). I have
authenticated referrals turned on, and I'm receiving the code parameter as
expected.
http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice?fb_action_ids=384156608318085&fb_action_types=foodonthetable_mrh%3Aplan_to_cook&fb_source=timeline_og&action_object_map=%7B%22384156608318085%22%3A10151004406923956%7D&code=AQAPExNw7MHkxcLTEi5L24iD79pVa-WYxyhBA_bhdWLCM0PCGDuPjh1WqmAyd3_O3_LSjYzPawrinHNP3nv9BCMB_XuTnr8De8xQ2AwXqCaeHUzZUPm2MPyQ_eodOC9-YtjkvXm_PzRX3JG58khalT3AJjVuZvKHn5hWGDSohXLRbHGxW-vOg_Whm3mt_WUkdd0#_=_
However, when I try to get the auth_token using this code, I'm not able to.
I've tried using a couple of different versions of the redirect_uri thinking
that might be the problem (based on other posts) but nothing seems to work.
redirect_uri = "http://foodonthetable.shadr.us/recipes/1007-spanish-chicken-and-rice"
redirect_uri = "http://foodonthetable.shadr.us/facebook_connect/connect"
code = "AQAPExNw7MHkxcLTEi5L24iD79pVa-WYxyhBA_bhdWLCM0PCGDuPjh1WqmAyd3_O3_LSjYzPawrinHNP3nv9BCMB_XuTnr8De8xQ2AwXqCaeHUzZUPm2MPyQ_eodOC9-YtjkvXm_PzRX3JG58khalT3AJjVuZvKHn5hWGDSohXLRbHGxW-vOg_Whm3mt_WUkdd0"
result = `curl -F client_id=#{client_id} -F redirect_uri=#{redirect_uri} -F client_secret=#{client_secret} -F code=#{code} https://graph.facebook.com/oauth/access_token`
puts result
No matter what I do here, I always get the following error:
{"error":{"message":"Error validating verification code.","type":"OAuthException","code":100}}
Any help would be appreciated.
This does fix it.
redirect_uri = request.url.split('&code=').first
I'm trying to run http://github.com/tardate/rails-authlogic-rpx-sample (only rails version was changed) but get error message http://gist.github.com/385696, when RPX returns information after successful authentication via Google Account. What is wrong here? And how I can fix it?
The code was successfully tested with rails 2.3.3 by its author: http://rails-authlogic-rpx-sample.heroku.com/
I run on Windows with cygwin and rails (2.3.5), rpx_now (0.6.20), authlogic_rpx (1.1.1).
Update
In several hours RPX rejected my app http://img96.imageshack.us/img96/2508/14128362.png
Update2
The same error message ( http://gist.github.com/386124) appears with http://github.com/grosser/rpx_now_example , but in this case RPX allows me to sign in (so far).
Solved
See below
Got error: Invalid parameter: apiKey (code: 1), HTTP status: 200
You have to first register your RPX app at http://www.RPXnow.com and set its name. You'll be assigned an API key which you should set in the config/environment.rb file:
RPX_API_KEY = ENV["RPX_API_KEY"]
RPX_APP_NAME = "your_app_name_here!"
Or: Read slide 35: http://www.slideshare.net/tardate/srbauthlogicrpx
You shouldn't have any constraints enforced at the database level.
The reason was trailing \r character in my API key. Apparently, non of the steps did key trimming and the exception was not processed in a good way.