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

  • Home
  • SEARCH
  • 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 9135553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:50:23+00:00 2026-06-17T08:50:23+00:00

I have youtube login setup with OAuth2 and upon a successful user registration I

  • 0

I have youtube login setup with OAuth2 and upon a successful user registration I would like to save the users gender and location in the database.

Checking the OAuth docs https://developers.google.com/accounts/docs/OAuth2Login#userinfocall
you can see that you can access a users gender and location along with things like name, email and their profile picture.

Below is my code for saving a users info to the db

user.rb

def self.from_omniauth(auth)
    where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user|
      user.provider = auth.provider
      user.uid = auth.uid
      user.name = auth.info.name
      user.email = auth.info.email
      user.picture = auth.info.image
      user.gender = auth.info.gender
      user.country = auth.info.locale
      user.oauth_token = auth.credentials.token
      user.oauth_expires_at = Time.at(auth.credentials.expires_at)
      user.save! 
      end
     end

but using the auth.info.USER_INFO config doesn’t seem to save these values to the database. Am i missing something?

Here are the parameters my app is asking for without any scopes.
enter image description here

UPDATE

I got this to work by passing in an extra scope for the userinfo.profile parameter. Remember to include full urls with no commas separated by a space.

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :youtube, YOUTUBE_KEY, YOUTUBE_SECRET, { :scope => "https://www.googleapis.com/auth/userinfo.profile https://gdata.youtube.com", access_type: 'offline', approval_prompt: '' }
end

This got the following permissions
enter image description here

  • 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-17T08:50:24+00:00Added an answer on June 17, 2026 at 8:50 am

    Can you post the code where you ask for OAuth scopes? My guess is that you aren’t asking for the profile scope. Check out this site:

    https://developers.google.com/oauthplayground/

    If you’re just using the YouTube sample code, you’re probably not asking for the profile scope:

    https://www.googleapis.com/auth/userinfo.profile

    You can tell if you are asking for this scope or not when you hit the auth page, because the auth page will say something like:

    “Google OAuth 2.0 Playground is requesting permission to:
    View basic information about your account
    View your name, public profile URL, and photo
    View your gender and birthdate
    View your country, language, and timezone”

    I’ve attached a screenshot.enter image description here If you’re not seeing this, look to where you are configuring your scopes and add this to the list of OAUth scopes to authorize.

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

Sidebar

Related Questions

I have a Youtube video embedded in a slideshow that I would like to
I have a string like so: http://www.youtube.com/v/Nnp82q3b844&hl=en_US&fs=1& and I want to extract the Nnp82q3b844
i follow the tutorial from youtube writing a code of login & registration but
I have a youtube video like so... <object id=video_1 class=a_video ....... However the css
I have seen in some websites like facebook, twitter and youtuBe. Codes are being
i am uploading video to youtube which by default uploads to user who have
i have a youtube video and a like button on top of it. The
I have 10 youtube channels that I like and I want to get the
My requirement is something like this.I have 1 youtube video url and i have
I have a web application, where users have to login with their facebook accounts.

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.