Giter VIP home page Giter VIP logo

go-example-application's Introduction

Go SSO & Directory Sync Example

An example Go Application demonstrating how to use the WorkOS Go SDK to authenticate users via SSO using Okta as an IdP and Directory Sync.


Prerequisites

  • Go

    You can ensure you have Go installed by running go version in your terminal, if you do not have go installed, you can installed it via homebrew by running brew install go or by downloading and installing the binary from here.

  • An Okta Account

    You can sign up for a developer account with Okta here.

  • A WorkOS Account

    If you do not already have a WorkOS account, you can sign up here.


Go Project Setup

  1. Clone this git repository using your preferred secure method (HTTPS or SSH)

    #HTTPS
    git clone https://github.com/rarevalo13/go-example-application.git
    

or

#SSH
git clone [email protected]:rarevalo13/go-example-application.git
  1. Once you have cloned the repository navigate to the root directory

    cd go-example-application 
    
  2. Obtain and make notes of the following values in your WorkOS account.

    • WorkOS API Key
    • WorkOS Client ID
    • Redirect URI this should be set to https://localhost:8000/callback, as well as in your WorkOS Redirects sections which can be found under the Developer heading in your dashboard on the left hand side.
    • WorkOS Connection ID
    • WorkOS Directory ID
  3. Once you’ve taken note of that, you create a .env file and fill in the values from step 3.


Okta SSO Setup with WorkOS

Once you’ve set up your developer account with Okta you’ll need to log in and create two applications under the Applications menu in your developer admin. You’ll want to create a SAML 2.0 application for the SSO integration, we have a guide on how to create it specifically for Okta here.

If you don’t have any users currently in Okta, you’ll want to create a few, you can do so by following the guide from Okta on how to create new users here.

The second application will be the directory sync Application which you can browse the application catalog by searching “bearer token” and you should see an application called SCIM 2.0 Test App (OAuth Bearer Token). Once you’ve created that app, you can follow along with our Okta specific guide that can be found here.


Running the local server

Once you have set up the two applications and configured them per the guides, you can navigate to your terminal and run the local server by running go run main.go this will start a local server on port 8000. If you navigate to localhost:8000 you should see a sign on display with 3 options. Clicking on the Okta option should bring you to the Okta login screen and you’d log in using any user that was created and assigned the application you created with this tutorial.

go-example-application's People

Contributors

rarevalo13 avatar

Watchers

 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.