Giter Site home page Giter Site logo

globus-auth-example-javascript's Introduction

⚠️ Archive Notice ⚠️

We recommend using the Globus JavaScript SDK to integrate Globus Auth and the rest of the Globus platform into your application.


Globus Examples

Globus Auth Example: A Javascript React SPA

This repo provides an example of integrating Globus Auth into a Javascript React Single Page Application (SPA). You can use this to integrate an auth layer into your application so that users can log in with any of the thousands of Globus-integrated identity providers.

The example uses js-pkce to do a PKCE flow for Globus Auth authentication and authorization. When the user is redirected back to the application from Globus Auth the token(s) are retrieved and you can use those to perform any actions you like.

Installation and Starting

  1. Install Node.JS and NPM
  2. Run npm install to install packages
  3. Update the Auth configuration to
  4. Run npm start to start the application

Configuration

The application is configured in Auth.js. Set your Globus Auth native client ID and other parameters here:

const PkceAuth = new PKCE({
  client_id: 'a63334f4-df31-4a43-9396-14c2615b3391',  // Update this using your native client ID
  redirect_uri: 'http://localhost:3000',  // Update this if you are deploying this anywhere else (Globus Auth will redirect back here once you have logged in)
  authorization_endpoint: 'https://auth.globus.org/v2/oauth2/authorize',  // No changes needed
  token_endpoint: 'https://auth.globus.org/v2/oauth2/token',  // No changes needed
  requested_scopes: 'openid profile email',  // Update with any scopes you would need, e.g. transfer
});

To configure it for your own application:

  1. Create a Globus Auth native client here
  2. Set up any restrictions, such as required identity providers, during this step
  3. Update the client ID, your redirects, and any additional scopes your need here

Questions and Support

Please feel to reach out with any support questions at Globus Support.

globus-auth-example-javascript's People

Contributors

dependabot[bot] avatar jbottigliero avatar sam-globus avatar

Stargazers

 avatar

Watchers

 avatar  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.