GithubHelp home page GithubHelp logo

isabella232 / okta-graphql-vue-olympics-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oktadev/okta-graphql-vue-olympics-example

0.0 0.0 0.0 5.51 MB

Secure GraphQL + Vue Example

Home Page: https://developer.okta.com/blog/2019/11/11/graphql-vue

License: Apache License 2.0

JavaScript 64.81% HTML 5.31% Vue 29.88%

okta-graphql-vue-olympics-example's Introduction

Secure GraphQL + Vue Example

This example app shows how to use GraphQL and Vue.js to build a Olympic Events app and add authentication with Okta.

Please read Use Vue and GraphQL to Build a Secure App to see how this app was created.

Prerequisites: Node.js and an internet connection.

Okta has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application.

Getting Started

To install this example application, run the following commands:

git https://github.com/oktadeveloper/okta-graphql-vue-olympics-example.git graphql-vue
cd graphql-vue

This will get a copy of the project installed locally. To install all of its dependencies and start each app, follow the instructions below.

To run the GraphQL API, cd into the olympics-server folder and install its dependencies:

npm i

Then start the server node index.js.

To run the client, cd into the olympics-client folder and run:

npm i
npm run serve

You won't be able to login unless you configure the app to use your Okta organization.

Setup Okta

Log in to your Okta Developer account (or sign up if you don’t have an account) and navigate to Applications > Add Application. Click Single-Page App, click Next, and give the app a name you’ll remember.

On the following screen, select Authorization Code for Grant type allowed and click Done to finalize the set-up.

Server Configuration

Open olympics-server/auth.js and replace {yourOktadomain} and {yourClientId} in the following code block.

const oktaJwtVerifier = new OktaJwtVerifier({
  clientId: '{yourClientId}',
  issuer: 'https://{yourOktaDomain}/oauth2/default'
});

NOTE: The value of {yourOktaDomain} should be something like dev-123456.okta.com. Make sure you don't include -admin in the value!

Client Configuration

For the client, set the issuer and client_id in olympics-client/main.js.

Vue.use(Auth, {
  issuer: 'https://{yourOktaDomain}/oauth2/default',
  client_id: '{yourClientId}',
  redirect_uri: 'http://localhost:8080/callback',
  pkce: true
});

Then restart both your server and client and you should be able to authenticate!

Links

This example uses the following libraries provided by Okta:

Help

Please post any questions as comments on the blog post, or visit our Okta Developer Forums.

License

Apache 2.0, see LICENSE.

okta-graphql-vue-olympics-example's People

Contributors

holgerschmitz avatar imgbotapp avatar mraible 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.