Welcome Guest Login Register Member List
ExpressionEngine Forums
Advanced Search
Username: Password:
Remember Me? forgot password?
You are here: Forum Home  >  Usage  >  Troubleshooting  >  Thread
   
 
Authentication Error
 
rudedog830
Posted: 25 June 2009 12:49 AM   [ Ignore ]  
Newbie
Rank
Total Posts:  26
Joined  2008-09-17

I am trying to make an API call to Tracks, but I continue to receive a 401 unauthorized error.  For example, when I execute the following call:

curl -H ‘Accept: application/xml’ -H ‘Content-Type: application/xml’ -u username:password http://tracks.mydomain.com/

I continually receive the 401 error.  I am not an expert in Rails and would appreciate some tips on how to troubleshoot the error.

Profile
 
Reinier Balt
Posted: 25 June 2009 06:53 AM   [ Ignore ]   [ # 1 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

I assume you are using tracks 1.7?

The url you are requesting is not correct. It needs the resource added, i.e. http://tracks.mydomain.com/todos.xml
see examples at http://tracks.mycomain.com/integrations/rest_api

furthermore I’m not sure it the Accept header is messing with things, but you should be able to leave it out.

Profile
 
rudedog830
Posted: 26 June 2009 02:50 AM   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  26
Joined  2008-09-17

Yes, I am using 1.7.  My first post should have included the resource name in the URL.  When I am not logged into Tracks and I attempt to load http://tracks.mydomain.com/todos.xml, I receive a username/password popup prompt.  My credentials, however, do not work.  When I login to Tracks prior to the call, I receive the xml page fine.

When I do a direct call through curl per the integrations page, I receive the 401 error:

401 Unauthorized: You are not authorized to interact with Tracks.

Profile
 
Reinier Balt
Posted: 26 June 2009 09:09 AM   [ Ignore ]   [ # 3 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

strange. If I use the same curl command as above, using /todos.xml, it works for me

are there any errors in your tracks log?

Profile
 
rudedog830
Posted: 28 June 2009 02:32 AM   [ Ignore ]   [ # 4 ]  
Newbie
Rank
Total Posts:  26
Joined  2008-09-17

Here are the errors in my tracks log, although I’m not sure how to interpret them:

Processing TodosController#index (for 70.122.255.23 at 2009-06-27 21:20:10) [GET]
  Session ID: 909e064cf9e43eb2b7523041f229626e
Rendering template within layouts/standard
Rendering todos/index
Completed in 1717ms (View: 912, DB: 194) | 200 OK [http://tracks.mydomain.com/]


Processing UnobtrusiveJavascriptController#generate (for 70.122.255.23 at 2009-06-27 21:20:12) [GET]
  Session ID: 909e064cf9e43eb2b7523041f229626e
  Parameters: {“page_path”=>[“index.js”]}
Completed in 2ms (View: 0, DB: 21) | 200 OK [http://tracks.mydomain.com/behaviours/index.js]


Processing LoginController#logout (for 70.122.255.23 at 2009-06-27 21:20:17) [GET]
  Session ID: 909e064cf9e43eb2b7523041f229626e
  Parameters: {“action”=>“logout”, “controller”=>“login”}
Cookie set: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
Redirected to /login
Completed in 9ms (DB: 4) | 302 Found [http://tracks.mydomain.com/logout]


Processing LoginController#login (for 70.122.255.23 at 2009-06-27 21:20:17) [GET]
  Session ID: 5a0db73bf4e836a27f55a3fdbb71775e
  Parameters: {“action”=>“login”, “controller”=>“login”}
Rendering template within layouts/login
Rendering login/login
Completed in 5ms (View: 4, DB: 1) | 200 OK [http://tracks.mydomain.com/login]


Processing ProjectsController#index to xml (for 70.122.255.23 at 2009-06-27 21:24:06) [GET]
  Session ID: 5a0db73bf4e836a27f55a3fdbb71775e
Filter chain halted as [:login_or_feed_token_required] rendered_or_redirected.
Completed in 1ms (View: 0, DB: 2) | 401 Unauthorized [http://tracks.mydomain.com/projects.xml]


Processing ProjectsController#index to xml (for 70.122.255.23 at 2009-06-27 21:24:13) [GET]
  Session ID: 5a0db73bf4e836a27f55a3fdbb71775e
Filter chain halted as [:login_or_feed_token_required] rendered_or_redirected.
Completed in 1ms (View: 0, DB: 4) | 401 Unauthorized [http://tracks.mydomain.com/projects.xml]


Processing ProjectsController#index to xml (for 70.122.255.23 at 2009-06-27 21:24:20) [GET]
  Session ID: 5a0db73bf4e836a27f55a3fdbb71775e
Filter chain halted as [:login_or_feed_token_required] rendered_or_redirected.
Completed in 1ms (View: 0, DB: 3) | 401 Unauthorized [http://tracks.mydomain.com/projects.xml]


Processing ProjectsController#index to xml (for 70.122.255.23 at 2009-06-27 21:24:26) [GET]
  Session ID: 5a0db73bf4e836a27f55a3fdbb71775e
Filter chain halted as [:login_or_feed_token_required] rendered_or_redirected.
Completed in 1ms (View: 0, DB: 2) | 401 Unauthorized [http://tracks.mydomain.com/projects.xml]


Processing ProjectsController#index to xml (for 70.122.255.23 at 2009-06-27 21:24:33) [GET]
  Session ID: 5a0db73bf4e836a27f55a3fdbb71775e
Filter chain halted as [:login_or_feed_token_required] rendered_or_redirected.
Completed in 1ms (View: 0, DB: 3) | 401 Unauthorized [http://tracks.mydomain.com/projects.xml]

Profile
 
Reinier Balt
Posted: 29 June 2009 10:56 AM   [ Ignore ]   [ # 5 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

these are normal log entries.

I’m just guessing now, but are you using strange characters in username or password that could get lost on the command line?

Profile
 
rudedog830
Posted: 30 June 2009 03:55 AM   [ Ignore ]   [ # 6 ]  
Newbie
Rank
Total Posts:  26
Joined  2008-09-17

No special characters.  Just alphanumeric.

When prompted for the username/password when trying to access the projects.xml page, I use the exact credentials that I use to successfully log into Tracks.

Is there additional logging that I can do to pinpoint this problem?  Could this have anything to do with my webserver configuration?

Profile
 
Reinier Balt
Posted: 30 June 2009 07:23 AM   [ Ignore ]   [ # 7 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

good idea. I remember that proxies could be removing username/password. Are you behind a proxy?

You could try to start tracks from the command line and curl it.

Profile
 
rudedog830
Posted: 01 July 2009 01:51 AM   [ Ignore ]   [ # 8 ]  
Newbie
Rank
Total Posts:  26
Joined  2008-09-17

My tracks installation is hosted.  However, I am not behind a proxy.  I have tried both Firefox and IE to ensure it isn’t a browser issue.  I’ve also accessed the login page via curl and I get the appropriate html in return.

Profile
 
Reinier Balt
Posted: 01 July 2009 08:45 PM   [ Ignore ]   [ # 9 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

can you ssh into your host? so you can try direct curl to the build in webserver?

Profile
 
rudedog830
Posted: 06 July 2009 12:57 AM   [ Ignore ]   [ # 10 ]  
Newbie
Rank
Total Posts:  26
Joined  2008-09-17

Solved!

On shared hosts, Apache sometimes doesn‘t pass authentication headers to FCGI instances. I needed to replace the rewriterule in public/.htaccess (replace the plain one) with:


RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]

This should probably be added to the wiki installation instructions for hosted installations.

Profile
 
Reinier Balt
Posted: 07 July 2009 07:31 AM   [ Ignore ]   [ # 11 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

added to http://www.getontracks.org/wiki/Known-Issues/

Profile
 
   
 
 
‹‹ font is huge      RSS Feed Sort Order ››

Powered By ExpressionEngine
Template Design By Sonnenvogel.com
Select a theme:

ExpressionEngine Discussion Forum - Version 2.1.2 (20091002)
Script Executed in 0.1366 seconds

Atom Feed
RSS 2.0