Getting Google Auth to work
So I might be missing something from the documentation but it looks like all i should have to do is put the client id for google as the public_key and my client secret as the private_key in the development credentials. I did that and restarted the server and there is no change to the log in and doesnt show the sign in with google. Am I missing something that I need to change somewhere else
When i go to the jumpstart admin it doesnt have any options to change anything under the Login & OAuth section. Just says to go into the development credentials file and add the keys, which I have done. I have tried hitting the save changes button and having it restart the server but that doesnt do anything
Maybe they're not in the right spot?
omniauth: facebook: public_key: private_key: github: public_key: private_key: twitter: public_key: private_key: google_oauth2: public_key: private_key:
Then in the Login & OAuth you'll see an Enable checkbox.
Just tested it locally and it's working for me.
The console log shows the following:
Access to fetch at 'https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=84462564647-uglhrahhoseso8dvpi7qs5ktgtsteub6.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Fgoogle_oauth2%2Fcallback&response_type=code&scope=email+profile&state=b228a91a817e402955a64c63afb151255365b74ab8c844cf' (redirected from 'http://localhost:3000/users/auth/google_oauth2?locale=en') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Access to fetch at 'https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=84462564647-uglhrahhoseso8dvpi7qs5ktgtsteub6.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Fgoogle_oauth2%2Fcallback&response_type=code&scope=email+profile&state=b228a91a817e402955a64c63afb151255365b74ab8c844cf' (redirected from 'http://localhost:3000/users/auth/google_oauth2?locale=en') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
That is from the console log
Started GET "/users/auth/facebook?locale=en" for ::1 at 2020-01-14 12:48:47 +0800
I, [2020-01-14T12:48:47.068597 #4708] INFO -- omniauth: (facebook) Request phase initiated.
Started GET "/users/auth/facebook?locale=en" for ::1 at 2020-01-14 12:48:47 +0800
I, [2020-01-14T12:48:47.300744 #4708] INFO -- omniauth: (facebook) Request phase initiated.
Started GET "/users/auth/facebook/callback?code=AQD3BOtrX1ivBmmpQHkbYZDfMoLhwRWCWSuMRFlntjpwZuCMo-gt80NFRmMT3zHpuf-vJ7yD9hhwdZKmXKpn5cZ70LKegwA7fEMCuZ5nN9vINDVAnM1SdynVNNhvshZtaQaQi_y1Qe4FUZa4D3Z0wRGsq2WoOk80dzSemzarcvet99V4Sg2lNXNtosNgjeNSE8egeJnkiIVw20bhj9Dmv_Y-ywMXn9KHD6AZsYm7WT1DNOAcyd5PoExhdBjrhzOZo3hTxm828UGE9HHrM2q9LwZoxVl40473zgFGbQNpDTKMYmvw0fhDSspuQt5URQCzb8n7ec0_lFhurkcRuF6K3X9y&state=b8d55c47be1973e1463b26ca545ad32410840714efc3ad4f" for ::1 at 2020-01-14 12:48:47 +0800
I, [2020-01-14T12:48:47.763662 #4708] INFO -- omniauth: (facebook) Callback phase initiated.
Processing by Users::OmniauthCallbacksController#facebook as HTML
Parameters: {"code"=>"AQD3BOtrX1ivBmmpQHkbYZDfMoLhwRWCWSuMRFlntjpwZuCMo-gt80NFRmMT3zHpuf-vJ7yD9hhwdZKmXKpn5cZ70LKegwA7fEMCuZ5nN9vINDVAnM1SdynVNNhvshZtaQaQi_y1Qe4FUZa4D3Z0wRGsq2WoOk80dzSemzarcvet99V4Sg2lNXNtosNgjeNSE8egeJnkiIVw20bhj9Dmv_Y-ywMXn9KHD6AZsYm7WT1DNOAcyd5PoExhdBjrhzOZo3hTxm828UGE9HHrM2q9LwZoxVl40473zgFGbQNpDTKMYmvw0fhDSspuQt5URQCzb8n7ec0_lFhurkcRuF6K3X9y", "state"=>"b8d55c47be1973e1463b26ca545ad32410840714efc3ad4f"}
User::ConnectedAccount Load (2.8ms) SELECT "user_connected_accounts".* FROM "user_connected_accounts" WHERE "user_connected_accounts"."provider" = $1 AND "user_connected_accounts"."uid" = $2 ORDER BY "user_connected_accounts"."id" ASC LIMIT $3 [["provider", "facebook"], ["uid", "10157796928347789"], ["LIMIT", 1]]
↳ app/models/user/connected_account.rb:47:in `for_auth'
User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "david.ng.hk@gmail.com"], ["LIMIT", 1]]
↳ lib/jumpstart/app/controllers/jumpstart/omniauth_callbacks_controller.rb:16:in `block (2 levels) in <class:OmniauthCallbacksController>'
Redirected to http://localhost:3000/users/sign_in?locale=en
Completed 302 Found in 43ms (ActiveRecord: 17.0ms | Allocations: 5955)
Started GET "/users/auth/facebook?locale=en" for ::1 at 2020-01-14 12:48:47 +0800
I, [2020-01-14T12:48:47.068597 #4708] INFO -- omniauth: (facebook) Request phase initiated.
Started GET "/users/auth/facebook?locale=en" for ::1 at 2020-01-14 12:48:47 +0800
I, [2020-01-14T12:48:47.300744 #4708] INFO -- omniauth: (facebook) Request phase initiated.
Started GET "/users/auth/facebook/callback?code=AQD3BOtrX1ivBmmpQHkbYZDfMoLhwRWCWSuMRFlntjpwZuCMo-gt80NFRmMT3zHpuf-vJ7yD9hhwdZKmXKpn5cZ70LKegwA7fEMCuZ5nN9vINDVAnM1SdynVNNhvshZtaQaQi_y1Qe4FUZa4D3Z0wRGsq2WoOk80dzSemzarcvet99V4Sg2lNXNtosNgjeNSE8egeJnkiIVw20bhj9Dmv_Y-ywMXn9KHD6AZsYm7WT1DNOAcyd5PoExhdBjrhzOZo3hTxm828UGE9HHrM2q9LwZoxVl40473zgFGbQNpDTKMYmvw0fhDSspuQt5URQCzb8n7ec0_lFhurkcRuF6K3X9y&state=b8d55c47be1973e1463b26ca545ad32410840714efc3ad4f" for ::1 at 2020-01-14 12:48:47 +0800
I, [2020-01-14T12:48:47.763662 #4708] INFO -- omniauth: (facebook) Callback phase initiated.
Processing by Users::OmniauthCallbacksController#facebook as HTML
Parameters: {"code"=>"AQD3BOtrX1ivBmmpQHkbYZDfMoLhwRWCWSuMRFlntjpwZuCMo-gt80NFRmMT3zHpuf-vJ7yD9hhwdZKmXKpn5cZ70LKegwA7fEMCuZ5nN9vINDVAnM1SdynVNNhvshZtaQaQi_y1Qe4FUZa4D3Z0wRGsq2WoOk80dzSemzarcvet99V4Sg2lNXNtosNgjeNSE8egeJnkiIVw20bhj9Dmv_Y-ywMXn9KHD6AZsYm7WT1DNOAcyd5PoExhdBjrhzOZo3hTxm828UGE9HHrM2q9LwZoxVl40473zgFGbQNpDTKMYmvw0fhDSspuQt5URQCzb8n7ec0_lFhurkcRuF6K3X9y", "state"=>"b8d55c47be1973e1463b26ca545ad32410840714efc3ad4f"}
User::ConnectedAccount Load (2.8ms) SELECT "user_connected_accounts".* FROM "user_connected_accounts" WHERE "user_connected_accounts"."provider" = $1 AND "user_connected_accounts"."uid" = $2 ORDER BY "user_connected_accounts"."id" ASC LIMIT $3 [["provider", "facebook"], ["uid", "10157796928347789"], ["LIMIT", 1]]
↳ app/models/user/connected_account.rb:47:in `for_auth'
User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "david.ng.hk@gmail.com"], ["LIMIT", 1]]
↳ lib/jumpstart/app/controllers/jumpstart/omniauth_callbacks_controller.rb:16:in `block (2 levels) in <class:OmniauthCallbacksController>'
Redirected to http://localhost:3000/users/sign_in?locale=en
Completed 302 Found in 43ms (ActiveRecord: 17.0ms | Allocations: 5955)
Notifications
You’re not receiving notifications from this thread.