Google oauth2 missing client_id

5,961 views
Skip to first unread message

Rusty Myers

unread,
Oct 23, 2014, 10:51:41 PM10/23/14
to openconfe...@googlegroups.com
Hello,

I'm working on setting up a test of the OpenConferenceWare and I'm having some issues getting Google Oauth2 to work. I'm quite new to ruby on rails, so forgive me for the basic understanding.

I've added the gem "omniauth-google-oauth2" and the following, with my appropriate client ID and secret to config/initializers/02_omniauth.rb :
   provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"]

I've made sure I've set up my developer project with the correct APIs and Consent Screen changes, as told to here:

I'm not using a custom view, just the link provided automatically on the login page.

When I attempt to log in via google, I am told I'm "Missing required parameter: client_id". Did I not add it in the right places?

Thanks

Rusty Myers

Rusty Myers

unread,
Oct 24, 2014, 8:05:52 AM10/24/14
to openconfe...@googlegroups.com
OK, so now I know a bit more about ENV variables. I figured out my mistake with Google Oauth2. I was placing the client_id inside the "ENV[myIDhere]" when I should have just replaced the whole ENV with the client_id. My followup question would be, is it the correct thing to do? Should I leave the ENV variables there and set my client_id elsewhere? Where?
Thanks!
Rusty 

Reid Beels

unread,
Oct 27, 2014, 9:33:42 PM10/27/14
to openconfe...@googlegroups.com
Hi Rusty,

It looks like you’re using the example code from the OAuth plugin, which uses environment variables. The idea with environment variables is that they’re set in your shell, outside of the app. This keeps sensitive information out of version control and is particularly useful if you’re deploying to someplace like heroku.

For local testing, you can set these environment variables in my shell, before running the app,like so:

export GOOGLE_CLIENT_ID="my_key"
export GOOGLE_CLIENT_SECRET="my_secret"

You can also put these commands in a file and source it in to your shell’s environment with `source secret_file_name`

Best,
Reid



--
You received this message because you are subscribed to the Google Groups "openconferenceware" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openconferencew...@googlegroups.com.
To post to this group, send email to openconfe...@googlegroups.com.
Visit this group at http://groups.google.com/group/openconferenceware.
For more options, visit https://groups.google.com/d/optout.

Rusty Myers

unread,
Nov 12, 2014, 3:05:09 PM11/12/14
to openconfe...@googlegroups.com
Thanks Reid,

I was able to set the variables and pull them in. 
Reply all
Reply to author
Forward
0 new messages