Posts

Showing posts from January, 2017

Authentication for WebSharper sitelet with JWT token in F#

Image
Authentication for WebSharper sitelet with Jwt token in F# Authentication is an important part of any Web applications. Today I will explain how we can create the essential modules required to authenticate a user. This post will be composed by four parts: 1. What is needed for authentication 2. Password encryption and storage 3. JWT token 4. OWIN auth middleware and WebSharper OWIN selfhost 5. Glue it all together 1. What is needed for authentication In this blog post we will see how to authenticate users with credentials userid and password. First, we will see how to store encrypted password and how we can verify credentials against the one contained in database. Then we will see how we can authenticate users while communicating between client (browser) and server with Jwt token. Lastly we will see how both glued together provide a reliable authentication story. 2. Password encryption and storage 2.1 Storage To store data I will be using Sqlite via Sqlite net pcl. If yo

Create a Splash screen on Xamarin.iOS Xamarin.Forms project

Image
Create a Splash screen for your Xamarin.iOS app to be used with Xamarin.Forms project Few weeks ago I explained how we can create a splash screen for Android . Xamarin.Forms takes few seconds to load at each start so it is important to provide a feedback to the user when they click on our icon. The splash screen answers that by providing a way to show a loading screen. Today we will see how we can setup a simple splashscreen with an image centered and with a text label. This post will be composed by 3 parts: Create the splash screen Understand layout constraints Layout the splash screen 1. Create the splash screen When creating a Xamarin.Forms project, the iOS project gets created with a Launchscreen.Storyboard. Compared to Xamarin.Android, this screen is already configured to show until your app has been fully loaded in the background. Open the storyboard and the storyboard editor should appear. Our splash screen will be composed by an image with a simple text therefore dr

Use FontAwesome on your Xamarin.iOS app with Xamarin.Forms

Use FontAwesome on your Xamarin.iOS app with Xamarin.Forms Few weeks ago I explained how we could use FontAwesome from our Droid project, you can read the post here . Following the same idea, today I will explain how we can use FontAwesome on an iOS app with Xamarin.Forms. This post is composed by three parts: Import of font into iOS project Define custom renderer Use from Xamarin.Forms 1. Import of font into iOS project Import the font in .ttf format by placing it under Resources. It should then become a BundledResource. Next in Info.plist, add a new entry Fonts provided by application and add the path to the font from Resources folder in the values. Once you have done this, the font should be available to use. 2. Define custom renderer Similarly to the Droid project , we need to create a custom renderer and overwrite the following function: OnElementPropertyChanged(...) This function is called by Xamarin when the properties of the element change. For example when the

Get started with SQLite in from Xamarin.Forms

Image
Get started with SQLite in from Xamarin.Forms Today I demonstrate how we can leverage sqlite to save data on mobile which can be useful for local application or to store cached data. In this post, I will show how we can use Sqlite from Xamarin.Forms in an Android application. This post will be composed by 3 parts: 1. Get Sqlite.net 2. Dependency service and database path 3. Use Sqlite from Xamarin.Forms 1. Get Sqlite The library that I always use is SQLite.net-pcl from praeclarum https://www.nuget.org/packages/sqlite-net-pcl/ .To not be confused with another SQLite.Net-PCL which is a fork of the original. To get started, simply install Sqlite in the Android project and in the Xamarin.Forms project. Once installed, Sqlite namespace should be accessible. And we should also have access to SqliteConnection . In order to start a connection, we need to provide a database path. The database path is platform specific. It is usually stored in a private folder of the application and is not