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 authenticationIn 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 storage2.1 StorageTo store data I will be using Sqlite via Sqlite net pcl. If you need a tutori…

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 projectFew 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 screenUnderstand layout constraintsLayout the splash screen1. Create the splash screenWhen 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 drag an image view and …

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

Use FontAwesome on your Xamarin.iOS app with Xamarin.FormsFew 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 projectDefine custom rendererUse from Xamarin.Forms1. Import of font into iOS projectImport 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 rendererSimilarly 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 text is changed or the colo…

Get started with SQLite in from Xamarin.Forms

Image
Get started with SQLite in from Xamarin.FormsToday 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 SqliteThe library that I always use is SQLite.net-pcl from praeclarumhttps://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 accessible …