Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.
/ go-sso-example Public archive

An example application demonstrating how to use the WorkOS Golang SDK to authenticate users via SSO

License

Notifications You must be signed in to change notification settings

workos/go-sso-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-sso-example

An example Go application demonstrating how to use the WorkOS Go SDK to authenticate users via SSO.

Prerequisites

  • Go

Go Project Setup

  1. In your CLI, navigate to the directory into which you want to clone this git repo.

    $ cd ~/Desktop/
  2. Clone this git repo using your preferred secure method (HTTPS or SSH).

    # HTTPS
    $ git clone https://github.com/workos-inc/go-sso-example.git

    or

    # SSH
    $ git clone git@github.com:workos-inc/go-sso-example.git
  3. Navigate to the cloned repo.

    $ cd go-sso-example
  4. Obtain and make note of the following values. In the next step, these will be set as environment variables.

  5. Create a new file called ".env" in the root of the project and add the following variables, replacing the xxx with the values from step 4:

    • WORKOS_API_KEY=xxx
    • WORKOS_CLIENT_ID=xxx
    • WORKOS_REDIRECT_URI=xxx
    • WORKOS_DOMAIN=xxx
  6. The final setup step is to start the server.

    $ go run .

    Navigate to localhost:3042 in your web browser. You should see a "Login" button. If you click this link, you'll be redirected to an HTTP 404 page because we haven't set up SSO yet!

    You can stop the local server for now by entering CTRL + c on the command line.

SSO Setup with WorkOS

Follow the SSO authentication flow instructions to set up an SSO connection.

When you get to the step where you provide the REDIRECT_URI value, use http://localhost:3042/callback.

If you get stuck, please reach out to us at support@workos.com so we can help.

Testing the Integration

  1. Naviagte to the go-sso-example directory.

    $ go run .

    Once running, navigate to http://localhost:3042 to test out the SSO workflow.

    Hooray!

Need help?

If you get stuck and aren't able to resolve the issue by reading our API reference or tutorials, you can reach out to us at support@workos.com and we'll lend a hand.

About

An example application demonstrating how to use the WorkOS Golang SDK to authenticate users via SSO

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published