Note that there are some explanatory texts on larger screens.

plurals
  1. POStoring OpenID information in database
    text
    copied!<p>This is a database question. I have an openid library already installed and working.</p> <p>I want to use OpenID on a website I'm working on. There are three types of users.</p> <ol> <li>Named accounts using email/password to authenticate</li> <li>Named accounts using OpenID to authenticate</li> <li>Anonymous account using OpenID to authenticate</li> </ol> <p>All of these users are stored in the same table to simply the comments table. Named accounts are linked to a blog that the account can manage. Anonymous users can comment on articles on the blog but they can't do anything else. If an anonymous user signs up for an account I want to automatically transfer that user's old comments to the named account. I'm currently doing this by having the users fill out a form with a unique name and a valid email. </p> <p>Currently both sets of accounts are stored in the same table using the following schema. (Yes it's a rails migration)</p> <pre><code>create_table :users do |t| t.string :name #unique because it maps to a subdomain t.string :openid_url #unique t.string :email #unique t.string :password_hash t.string :password_salt t.boolean :guest #Anonymous user flag t.timestamps end </code></pre> <p>(<code>openid_url</code> is unique to prevent multiple accounts from being attached to the same openid. <code>email</code> is unique because users login with email/password)</p> <p>I'm using this setup I've run into a problem with Google's OpenID implementation. Every user that uses Google for OpenID has the same url: <a href="https://www.google.com/accounts/o8/ud" rel="noreferrer">https://www.google.com/accounts/o8/ud</a>.</p> <p>How do I support using google as an openid provider since it's urls are not unique for each user? (Please remember the constraints that exist) </p> <p>Note: Google Accounts can use any valid email address on the internet so I can't just store person@google.com in the openid_url field because the email could be person@example.com or worse person@yahoo.com! Yahoo also uses this single url method so I have to support them too.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload