Hi, I created my own osm server and I appended some data. I would like to use iD editor to change something, but I'm not able to do it. When I press edit tab in the web I receive the application error 500. In the following the lines in the production.log:

I, [2015-06-24T09:16:14.256607 #14679] INFO -- : Rendered site/id.html.erb (182.3ms) I, [2015-06-24T09:16:14.256943 #14679] INFO -- : Completed 500 Internal Server Error in 189ms (ActiveRecord: 3.1ms) F, [2015-06-24T09:16:14.258915 #14679] FATAL -- : ActionView::Template::Error (undefined method access_token_for_user' for nil:NilClass): 28: .locale("<%= locale %>", "<%= asset_path("iD/locales/#{locale}.json") %>") 29: .preauth({ 30: <% token = @user.access_token(ID_KEY) %> 31: url: "<%= request.protocol + request.host_with_port %>", 32: oauth_consumer_key: "<%= token.client_application.key %>", 33: oauth_secret: "<%= token.client_application.secret %>", 34: oauth_token: "<%= token.token %>", app/models/user.rb:239:inaccess_token' app/views/site/id.html.erb:31:in _app_views_site_id_html_erb___1011942628133712304_61090920' app/controllers/site_controller.rb:118:inid' config/initializers/cors.rb:9:in `call'

I think the problem is related to user_tokens and client_applications table. I do not know how to fill them. Could you help me?

Thank you, Laura

asked 24 Jun '15, 10:43

Laura's gravatar image

Laura
11112
accept rate: 0%

edited 14 Jul '15, 22:24

aseerel4c26's gravatar image

aseerel4c26 ♦
32.3k16241553


I think you are getting this error because @user is nil on line 30. The rails site will redirect to the login page if there is no @user, so you probably changed some code elsewhere that performs the redirect.

Alternatively, on your site you could choose to allow un-loggedin users to use iD by wrapping the preauth code in a condition that will just not include it if @user is nil. iD will work fine without preauth, but will prompt the user to authenticate when they attempt to save something.

permanent link

answered 26 Jun '15, 10:33

bhousel's gravatar image

bhousel
1.9k12427
accept rate: 37%

edited 26 Jun '15, 10:33

Hi, Thank you for your answer. I have not changed the server code, but probably there are some problems in some database tables. I was wondering if someone can help me in understanding what I have to write in the user_tokens and client_applications table for a particular user. Thank you, Laura

(06 Jul '15, 14:52) Laura
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×274

question asked: 24 Jun '15, 10:43

question was seen: 2,394 times

last updated: 14 Jul '15, 22:24

powered by OSQA