Git Product home page Git Product logo

onelogin's Introduction

onelogin

OneLogin client written in Go.

GoDoc Go Report Card Build Status

This is a fork of arkan/onelogin that has been extended to implement authentication methods that support MFA. It's drifted in time to suit my needs.

Getting Started

go get github.com/asobrien/onelogin

Register an application on OneLogin

First you need to register a new application to have clientID and clientSecret credentials.

At a minimum your credentials need "Authentication Only" scope in order to authenticate a user. Querying the API, requires additional scopes which do not include the ability to authenticate.

If you need to authenticate users are programatically use the API, you will need to use two sets of credentials and reinitialize the client. Only the "Manage All" scope has the ability to authenticate users and interact with the API.

Quickstart

List Users

c := onelogin.New(clientID, clientSecret, "us_or_eu", team)
users, err := c.User.GetUsers(context.Background())

Authenticate

Authenticate via username/password:

c := onelogin.New(clientID, clientSecret, "us_or_eu", team)
user, err := c.Authenticate(context.Background(), "username", "password")

Note this authentication method always returns a user, if authentication if successful, regardless of whether MFA is required or not. To authenticate a user with strict MFA validation, use the AuthenticateWithVerify function:

c := onelogin.New(clientID, clientSecret, "us_or_eu", team)
user, err := c.AuthenticateWithVerify(context.Background(), "username", "password", "Google Authenticator", "123456")

See the documentation for all the available commands.

Licence

MIT

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.