This is a very basic implementation of using the ASP.NET OAuth2 authentication libraries to allow users to log in with Google and Microsoft in an F# Bolero project. The example code uses a "user info" object to send the user's claims and other data from the server side to the client side.
I mainly created this project because I couldn't find any examples online of someone setting up external logins in Bolero using OAuth2 providers.
This project contains the code for setting up Google and Microsoft logins, so you'll need to create app registrations for both to get your client id and client secrets respectively.
💡 If you would rather not implement both, you can remove the registration of the one you don't want from the
ConfigureServices
method in the server project'sStartup.fs
, and then remove associated button from theview
function in the client project'sMain.fs
file.
- Clone the repository
- Run
dotnet tool restore
in the project root, then rundotnet paket install
to install dependencies. - Add your Google/Microsoft client id and secret to the server project's User Secrets.
- Build and run the project, and click on the buttons to log in to a provider.
- You should see your account's name and internal GUID on the home page.