Giter Site home page Giter Site logo

bc-auth0-oidc's Introduction

BigCommerce Auth0 OpenID Connect (OIDC) Customer Login Middleware

This is a simple Express example (ie, not production-ready) of how Auth0 OIDC can be used to create and authenticate users into a Stencil BigCommerce Storefront using the Customer Login API that accepts a JWT.

This example uses only Google login and creates the user in BigCommerce if they do not already exist. Further work required to add additional.

Uses Auth0's Open ID Connect

Setup

Copy .env.template to .env ander complete details:

ISSUER_BASE_URL= {the base domain from Auth0}
CLIENT_ID= {the client ID from the app created in Auth0}
BASE_URL= {URL of the middleware}
SECRET= {min 32 char secret}

TARGET_DOMAIN= {base URL of BC store (no trailing slash)}
LOGOUT_TARGET_URL= {logout URL in BC store eg, TARGET_DOMAIN/login.php?action=logout}

PORT=4000 

# BigCommerce API credentials
BC_STORE_ID=
BC_ACCESS_TOKEN=
BC_CLIENT_ID=
BC_CLIENT_SECRET=

Auth0 Setup

Create a new account and application. Configure Applicaiton URIs:

Allowed Callback URLs :

eg http://localhost:4000/callback

Allowed Logout URLs :

eg {TARGET_DOMAIN}/login.php?action=logout

Stencil Setup

  • Configure Login links to point to {BASE_URL} above. This will login/register the user, login via JWT
  • Configure Logout links to point to {BASE_URL}/logout, it will redirect back to {LOGOUT_TARGET_URL}. This will logout the user from Auth0 then redirect to the logout page in Stencil to logout there also
  • Further work required to control register/login/logout flow

bc-auth0-oidc's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.