SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Omniauth Gem




All, Every and                  Authentication
 Everywhere




                 Omni + auth        By
                                    Sumit Munot
How to Use Omniauth to Authenticate Our
                Users?

We Needs to Sign Up For Various Applications and
Sites Separately.

Why?
We have already sign up on many, using different
usernames, that going back to one of them and
trying to remember our credentials is sometimes
impossible.
Now a days, most of the sites offering alternative
way to sign up,

By allowing us to use other sites accounts.
Like
• Google Account
• Twitter
• GitHub
• Facebook

It feels like a long and arduous task.

But fear not, Omniauth is here to help.
Omniauth allows us to easily
integrate more than sixty
 authentication providers!
Preparing Application

Create Rails application
rails new application_name

In GEMFILE add
gem 'omniauth'

Then,
Bundle install
Creating a Provider
How add a provider to Omniauth?

We need to sign up as a developer on
providers site.

Then just we will have to make two settings in
our application regarding
Username and Password.
If you want to use Facebook authentication
head over to
                                             Create new
developers.facebook.com/apps                  app here
and
click on “Create New App”
Getting our App id/ API key and App Secret from settings
Add Provider To The App
      Create a new file under config/initializers called
      omniauth.rb.

Rails.application.config.middleware.use OmniAuth::Builder do

provider :facebook, YOUR_APP_ID, YOUR_APP_SECRET

end


       Create the Controller Session

              $> rails generate controller sessions new create failure
Set path in routes.rb
get '/login', :to => 'sessions#new', :as => :login

match '/auth/:provider/callback', :to => 'sessions#create'

match '/auth/failure', :to => 'sessions#failure'




In Controller app/controllers/sessions_controller.rb just add
def Create

auth_hash = request.env['omniauth.auth']

render :text => auth_hash.inspect

end
Now make sure everything is working.

Point the browser to

localhost:3000/auth/facebook/
Then,

we’ll be redirected to Facebook so we can authorize our app.

We will Authorize it, and we will be redirected back to our app

and see a hash with some information.

In between will be our name, our Facebook user id, and our email, among other things.

If error occurred then,
Change Some Setting in Facebook/apps for site
redirection


                                                      Blank App
                                                      Domains




                                        Change site
                                           URL
Thanks

Weitere ähnliche Inhalte

Was ist angesagt?

App builder svco-productdeck-basilarackal
App builder svco-productdeck-basilarackalApp builder svco-productdeck-basilarackal
App builder svco-productdeck-basilarackalNihal Ismail
 
Salesforce Marketing Cloud connector for Wordpress WooCommerce
Salesforce Marketing Cloud connector for Wordpress WooCommerceSalesforce Marketing Cloud connector for Wordpress WooCommerce
Salesforce Marketing Cloud connector for Wordpress WooCommerceWebkul Software Pvt. Ltd.
 
How to integrate a subscription form with WordPress using a free plugin?
How to integrate a subscription form with WordPress using a free plugin?How to integrate a subscription form with WordPress using a free plugin?
How to integrate a subscription form with WordPress using a free plugin?GeniusContacts
 
How to Build Your Own Social Network with Elgg?
How to Build Your Own Social Network with Elgg?How to Build Your Own Social Network with Elgg?
How to Build Your Own Social Network with Elgg?Jaakko Naakka
 
Mobile Website Tutorial
Mobile Website TutorialMobile Website Tutorial
Mobile Website TutorialPuttiApps
 
Designing REST API
Designing REST APIDesigning REST API
Designing REST APIJoseph Jude
 
Forms authentication in asp dot net
Forms authentication in asp dot netForms authentication in asp dot net
Forms authentication in asp dot netPooja Gaikwad
 
Creating an app on Ribily Part 3 flow creation
Creating an app on Ribily Part 3 flow creationCreating an app on Ribily Part 3 flow creation
Creating an app on Ribily Part 3 flow creationSagar Kalkhair
 
Beyond the Theme - Using WordPress as an API
Beyond the Theme - Using WordPress as an APIBeyond the Theme - Using WordPress as an API
Beyond the Theme - Using WordPress as an APIDavid Tufts
 
DevelopmentIntegrationGuides-Warbler
DevelopmentIntegrationGuides-WarblerDevelopmentIntegrationGuides-Warbler
DevelopmentIntegrationGuides-WarblerMark Dunlap
 
Descriptomatic review
Descriptomatic reviewDescriptomatic review
Descriptomatic reviewFred Kong
 
O365con14 - a developer jam with yammer
O365con14 - a developer jam with yammerO365con14 - a developer jam with yammer
O365con14 - a developer jam with yammerNCCOMMS
 
JoomlaEXPO: Search Engine Friendly URLs - Azrul.com
JoomlaEXPO: Search Engine Friendly URLs - Azrul.comJoomlaEXPO: Search Engine Friendly URLs - Azrul.com
JoomlaEXPO: Search Engine Friendly URLs - Azrul.comJohn Coonen
 

Was ist angesagt? (19)

App builder svco-productdeck-basilarackal
App builder svco-productdeck-basilarackalApp builder svco-productdeck-basilarackal
App builder svco-productdeck-basilarackal
 
Salesforce Marketing Cloud connector for Wordpress WooCommerce
Salesforce Marketing Cloud connector for Wordpress WooCommerceSalesforce Marketing Cloud connector for Wordpress WooCommerce
Salesforce Marketing Cloud connector for Wordpress WooCommerce
 
How to integrate a subscription form with WordPress using a free plugin?
How to integrate a subscription form with WordPress using a free plugin?How to integrate a subscription form with WordPress using a free plugin?
How to integrate a subscription form with WordPress using a free plugin?
 
How to Build Your Own Social Network with Elgg?
How to Build Your Own Social Network with Elgg?How to Build Your Own Social Network with Elgg?
How to Build Your Own Social Network with Elgg?
 
Directory submission
Directory submissionDirectory submission
Directory submission
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
Urello wcabq
Urello wcabqUrello wcabq
Urello wcabq
 
Mobile Website Tutorial
Mobile Website TutorialMobile Website Tutorial
Mobile Website Tutorial
 
Designing REST API
Designing REST APIDesigning REST API
Designing REST API
 
Mule roles
Mule rolesMule roles
Mule roles
 
Forms authentication in asp dot net
Forms authentication in asp dot netForms authentication in asp dot net
Forms authentication in asp dot net
 
Creating an app on Ribily Part 3 flow creation
Creating an app on Ribily Part 3 flow creationCreating an app on Ribily Part 3 flow creation
Creating an app on Ribily Part 3 flow creation
 
Beyond the Theme - Using WordPress as an API
Beyond the Theme - Using WordPress as an APIBeyond the Theme - Using WordPress as an API
Beyond the Theme - Using WordPress as an API
 
DevelopmentIntegrationGuides-Warbler
DevelopmentIntegrationGuides-WarblerDevelopmentIntegrationGuides-Warbler
DevelopmentIntegrationGuides-Warbler
 
Descriptomatic review
Descriptomatic reviewDescriptomatic review
Descriptomatic review
 
O365con14 - a developer jam with yammer
O365con14 - a developer jam with yammerO365con14 - a developer jam with yammer
O365con14 - a developer jam with yammer
 
Joomla Amazon Affiliate
Joomla Amazon AffiliateJoomla Amazon Affiliate
Joomla Amazon Affiliate
 
Let's do SPA
Let's do SPALet's do SPA
Let's do SPA
 
JoomlaEXPO: Search Engine Friendly URLs - Azrul.com
JoomlaEXPO: Search Engine Friendly URLs - Azrul.comJoomlaEXPO: Search Engine Friendly URLs - Azrul.com
JoomlaEXPO: Search Engine Friendly URLs - Azrul.com
 

Andere mochten auch

OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)Michael Bleigh
 
Building a Rails API with the JSON API Spec
Building a Rails API with the JSON API SpecBuilding a Rails API with the JSON API Spec
Building a Rails API with the JSON API SpecSonja Peterson
 
herokuでfacebookアプリを作ったお話
herokuでfacebookアプリを作ったお話herokuでfacebookアプリを作ったお話
herokuでfacebookアプリを作ったお話Naoto Koshikawa
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionIn a Rocket
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting PersonalKirsty Hulse
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldabaux singapore
 

Andere mochten auch (9)

Devise and Rails
Devise and RailsDevise and Rails
Devise and Rails
 
OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)
 
Rails course day 6
Rails course day 6Rails course day 6
Rails course day 6
 
Building a Rails API with the JSON API Spec
Building a Rails API with the JSON API SpecBuilding a Rails API with the JSON API Spec
Building a Rails API with the JSON API Spec
 
herokuでfacebookアプリを作ったお話
herokuでfacebookアプリを作ったお話herokuでfacebookアプリを作ったお話
herokuでfacebookアプリを作ったお話
 
Learn BEM: CSS Naming Convention
Learn BEM: CSS Naming ConventionLearn BEM: CSS Naming Convention
Learn BEM: CSS Naming Convention
 
SEO: Getting Personal
SEO: Getting PersonalSEO: Getting Personal
SEO: Getting Personal
 
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika AldabaLightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Ähnlich wie Omniauth

OAuth Introduction
OAuth IntroductionOAuth Introduction
OAuth Introductionh_marvin
 
Creating a content managed facebook app
Creating a content managed facebook appCreating a content managed facebook app
Creating a content managed facebook appOS-Cubed, Inc.
 
Introduction to OAuth 2.0 - Part 1
Introduction to OAuth 2.0 - Part 1Introduction to OAuth 2.0 - Part 1
Introduction to OAuth 2.0 - Part 1Nabeel Yoosuf
 
Introduction to OAuth 2.0 - Part 1
Introduction to OAuth 2.0  - Part 1Introduction to OAuth 2.0  - Part 1
Introduction to OAuth 2.0 - Part 1Nabeel Yoosuf
 
Facebook SSO.docx
Facebook SSO.docxFacebook SSO.docx
Facebook SSO.docxehathis
 
How to create Zoom Meet with Pega
How to create Zoom Meet with PegaHow to create Zoom Meet with Pega
How to create Zoom Meet with PegaSamuelJude1
 
Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...Katy Slemon
 
Integrate facebook using mule esb
Integrate facebook using mule esbIntegrate facebook using mule esb
Integrate facebook using mule esbSanjeet Pandey
 
Intro To Bebo Applications by Thought Labs
Intro To Bebo Applications by Thought LabsIntro To Bebo Applications by Thought Labs
Intro To Bebo Applications by Thought LabsJohn Maver
 
Dreamwares_Salesforce Updated
Dreamwares_Salesforce UpdatedDreamwares_Salesforce Updated
Dreamwares_Salesforce UpdatedAmit Ahuja
 
Progressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting StartedProgressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting StartedGaurav Behere
 
SharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010, Claims-Based Identity, Facebook, and the CloudSharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010, Claims-Based Identity, Facebook, and the CloudDanny Jessee
 
SharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010,Claims-Based Identity, Facebook, and the CloudSharePoint 2010,Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010, Claims-Based Identity, Facebook, and the CloudDanny Jessee
 
Login Register with Social Account using PHP
Login Register with Social Account using PHPLogin Register with Social Account using PHP
Login Register with Social Account using PHPAtozWebhelp
 
Dreamwares_SF Expertise
Dreamwares_SF ExpertiseDreamwares_SF Expertise
Dreamwares_SF ExpertiseManidipa Mitra
 

Ähnlich wie Omniauth (20)

OAuth Introduction
OAuth IntroductionOAuth Introduction
OAuth Introduction
 
Creating a content managed facebook app
Creating a content managed facebook appCreating a content managed facebook app
Creating a content managed facebook app
 
Introduction to OAuth 2.0 - Part 1
Introduction to OAuth 2.0 - Part 1Introduction to OAuth 2.0 - Part 1
Introduction to OAuth 2.0 - Part 1
 
Introduction to OAuth 2.0 - Part 1
Introduction to OAuth 2.0  - Part 1Introduction to OAuth 2.0  - Part 1
Introduction to OAuth 2.0 - Part 1
 
Facebook SSO.docx
Facebook SSO.docxFacebook SSO.docx
Facebook SSO.docx
 
How to create Zoom Meet with Pega
How to create Zoom Meet with PegaHow to create Zoom Meet with Pega
How to create Zoom Meet with Pega
 
Facebook Coin
Facebook CoinFacebook Coin
Facebook Coin
 
Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...
 
Integrate facebook using mule esb
Integrate facebook using mule esbIntegrate facebook using mule esb
Integrate facebook using mule esb
 
OAuth 2.0
OAuth 2.0OAuth 2.0
OAuth 2.0
 
Intro To Bebo Applications by Thought Labs
Intro To Bebo Applications by Thought LabsIntro To Bebo Applications by Thought Labs
Intro To Bebo Applications by Thought Labs
 
Dreamwares_Salesforce Updated
Dreamwares_Salesforce UpdatedDreamwares_Salesforce Updated
Dreamwares_Salesforce Updated
 
Progressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting StartedProgressive Web Apps - Overview & Getting Started
Progressive Web Apps - Overview & Getting Started
 
Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
 
SharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010, Claims-Based Identity, Facebook, and the CloudSharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
 
Facebook + Ruby
Facebook + RubyFacebook + Ruby
Facebook + Ruby
 
SharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010,Claims-Based Identity, Facebook, and the CloudSharePoint 2010,Claims-Based Identity, Facebook, and the Cloud
SharePoint 2010, Claims-Based Identity, Facebook, and the Cloud
 
Login Register with Social Account using PHP
Login Register with Social Account using PHPLogin Register with Social Account using PHP
Login Register with Social Account using PHP
 
Dreamwares_SF Expertise
Dreamwares_SF ExpertiseDreamwares_SF Expertise
Dreamwares_SF Expertise
 
Mule with facebook
Mule with facebookMule with facebook
Mule with facebook
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Omniauth

  • 1. Omniauth Gem All, Every and Authentication Everywhere Omni + auth By Sumit Munot
  • 2. How to Use Omniauth to Authenticate Our Users? We Needs to Sign Up For Various Applications and Sites Separately. Why? We have already sign up on many, using different usernames, that going back to one of them and trying to remember our credentials is sometimes impossible.
  • 3. Now a days, most of the sites offering alternative way to sign up, By allowing us to use other sites accounts. Like • Google Account • Twitter • GitHub • Facebook It feels like a long and arduous task. But fear not, Omniauth is here to help.
  • 4. Omniauth allows us to easily integrate more than sixty authentication providers!
  • 5. Preparing Application Create Rails application rails new application_name In GEMFILE add gem 'omniauth' Then, Bundle install
  • 6. Creating a Provider How add a provider to Omniauth? We need to sign up as a developer on providers site. Then just we will have to make two settings in our application regarding Username and Password.
  • 7. If you want to use Facebook authentication head over to Create new developers.facebook.com/apps app here and click on “Create New App”
  • 8. Getting our App id/ API key and App Secret from settings
  • 9. Add Provider To The App Create a new file under config/initializers called omniauth.rb. Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, YOUR_APP_ID, YOUR_APP_SECRET end Create the Controller Session $> rails generate controller sessions new create failure
  • 10. Set path in routes.rb get '/login', :to => 'sessions#new', :as => :login match '/auth/:provider/callback', :to => 'sessions#create' match '/auth/failure', :to => 'sessions#failure' In Controller app/controllers/sessions_controller.rb just add def Create auth_hash = request.env['omniauth.auth'] render :text => auth_hash.inspect end
  • 11. Now make sure everything is working. Point the browser to localhost:3000/auth/facebook/ Then, we’ll be redirected to Facebook so we can authorize our app. We will Authorize it, and we will be redirected back to our app and see a hash with some information. In between will be our name, our Facebook user id, and our email, among other things. If error occurred then,
  • 12. Change Some Setting in Facebook/apps for site redirection Blank App Domains Change site URL