Skip to content

Account Linking with OmniAuth

Brett Chalupa edited this page Jun 9, 2014 · 1 revision

Supermarket uses OmniAuth for authentication and account linking with various OAuth2 providers. Currently, Supermarket supports authentication with oc-id (Chef's authentication service) and account linking with GitHub.

Adding Additional Providers

You can add support for additional OAUTH providers by creating an extractor object in app/extractors.

Since each OmniAuth provider returns a different set of information, you often end up with nested case statements to account for all the different providers. Supermarket accounts for this behavior using Extractor objects. Each OmniAuth provider must have an associated Extractor object that extracts the correct information from the OmniAuth response hash into a object with a unified interface.