Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7979355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:45:20+00:00 2026-06-04T09:45:20+00:00

I created my authentication from scratch using Hartl’s Railstutorial http://ruby.railstutorial.org/chapters/modeling-users#sec:user_model . I want to

  • 0

I created my authentication from scratch using Hartl’s Railstutorial http://ruby.railstutorial.org/chapters/modeling-users#sec:user_model.

I want to implement a Facebook and Twitter log in for my website project. I am comsidering using OmniAuth after watching Railscasts Simple Omniauth http://railscasts.com/episodes/241-simple-omniauth?view=comments.

In the video, we are instructed to generate a user model:

rails generate model user provider:string uid:string name:string

Is the uid unique to the Twitter and Facebook log in or is it the same thing as my id attribute in my User model?

Simply, do I need to add a uid column to my user model to implement OmniAuth?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:45:21+00:00Added an answer on June 4, 2026 at 9:45 am

    The UID is the user id for facebook or twitter login. It is not the same as the ‘id’ field in the User model.

    Omniauth uses an environment variable to set a hash. In this hash is a ‘uid’ key, which you will want to use to lookup your User in you database. It also sets a ‘provider’ key, so the combination of the ‘uid’ key and ‘provider’ key gives you the ability to look up your user record, e.g.

    auth = request.env["omniauth.auth"]
    user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) 
    

    So, your model (User) will need to have both ‘provider’ and ‘uid’ columns for this to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a user login page and am using Forms Authentication. Users are
I am using HgEclipse from here: http://www.javaforge.com/project/HGE I have created a new repository on
I've created a simple webapp with user authentication. I've made two models: Users for
I succesfully created a project using seam credentials for authentication, but right now some
We're using Forms Authentication in SharePoint. When the account is created, the administrator can
I am writing a webapp using CodeIgniter that requires authentication. I created a model
I have created a simple API for a Rails application using token-based-authentication that supports
I have created a blog application using Ruby on Rails and have just added
I created a simple wcf service that retrieves data from crm 4.0 using the
I'm really enjoying using CakePHP's authentication and authorization components and have created custom components

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.