Code Monkey home page Code Monkey logo

fable.oidcclient's Introduction

Fable.OidcClient Nuget

Library to provide OpenID Connect (OIDC) and OAuth2 protocol support for client applications written in F#. It's a Fable binding for oidc-client javascript library.

How to start using this package

In a directory where your project's .fsproj file is:

dotnet add package Fable.OidcClient

In a directory where your project's package.json is:

npm install oidc-client 

Examples

Repositories showing examples of using Fable.OidcClient with:

Initialise the User Manager

open Fable.OidcClient
open Fable.Core.JsInterop // Required for the "!!" operator.

let settings: UserManagerSettings = 
    !!{| 
        authority = Some "https://localhost:5001"
        client_id = Some "js"
        redirect_uri = Some "https://localhost:5003/callback.html"
        response_type = Some "code"
        scope = Some "openid profile scope1"
        post_logout_redirect_uri = Some "https://localhost:5003/index.html"
        
        filterProtocolClaims = Some true
        loadUserInfo = Some true
    |}

let mgr: UserManager = Oidc.UserManager.Create settings

// From here you can call
// mgr.signinRedirect() to redirect to login page,
// mgr.signoutRedirect() to redirect to logout page,
// mgr.getUser() to retrieve user's details,
// etc...

Handle the OpenId Connect redirect protocol

open Fable.OidcClient
open Fable.Core.JsInterop

let mgr: UserManager = Oidc.UserManager.Create !!{| response_mode = Some "query" |}

promise {
    console.log "mgr.signinRedirectCallback()"
    let! user = mgr.signinRedirectCallback()
    console.log (sprintf "%A" user)
    window.location.href <- "index.html"
} |> ignore

fable.oidcclient's People

Contributors

mjarosie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vijoc dneivzz

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.