Coder Social home page Coder Social logo

marmelab / ra-example-oauth Goto Github PK

View Code? Open in Web Editor NEW
53.0 6.0 16.0 5.37 MB

An example of OpenID Connect implementation on React Admin

Home Page: https://marmelab.com/ra-example-oauth/

License: MIT License

HTML 35.74% JavaScript 13.03% CSS 0.42% Makefile 2.00% TypeScript 48.81%
react react-admin

ra-example-oauth's Introduction

ra-example-oauth

This example shows how to support OAuth in a react-admin v4 application.

Requirements

  1. A google application: ret up a project in the Google API Console to obtain OAuth 2.0 credentials, set a redirect URI, and (optionally) customize the branding information that your users see on the user-consent screen
  2. Configure OAuth for this application with http://localhost:5173/auth-callback as the authorized origin and http://localhost:5173/auth-callback as the authorized redirect URI. Copy the client ID and secret.
  3. Rename the .env.template files in both the app and api directory and update the following variables:
    • VITE_OIDC_CLIENT_ID: Paste the client ID you copied at step 2
    • OIDC_CLIENT_ID: Paste the client ID you copied at step 2
    • OIDC_CLIENT_SECRET: Paste the secret you copied at step 2

Installation

Run the following command:

make install

Development

  1. Start the API by running:

    make run-api
  2. In another terminal, start the application by running:

    make run-app

ra-example-oauth's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ra-example-oauth's Issues

Change example to use PKCE authorization code flow

@Kmaschta @exabugs

So I noticed that the server call is mandatory in this example because it is using OIDC secrets directly to look up the token. However, it is actually possible to do frontend-only authentication with OIDC (in fact, the library that you’re using - oidc-client - actually handles ALL of the bespoke authorization code flow logic that you’ve implemented in your authProvider); however, there is literally zero example of such flow being implemented with react-admin, and react-admin really does NOT play well with the redirects of the OIDC code flow.

Therefore it would be INSANELY nice if you could drop the unnecessary server call and implement a proper OIDC code flow with react-admin’s authProvider. Thank you.

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.