Token Authentication - Secured Challenge

This sample demonstrates accessing secured services using ArcGIS token-based authentication. Token-based authentication is supported for ArcGIS Server, ArcGIS Online, and ArcGIS Enterprise version 10.2 or earlier. The application prompts for a username and password to access a secured service. If the credentials are valid, the response provides a token to include with requests for secured content on the portal.

Code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.TokenSecuredChallenge.TokenSecuredChallenge"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:ArcGISRuntimeXamarin.Samples.TokenSecuredChallenge"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms">
    <ContentPage.Resources>
        <ResourceDictionary>
            <local:LoadStatusToColorConverter x:Key="StatusToColor"/>
        </ResourceDictionary>
    </ContentPage.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <StackLayout x:Name="PublicLayerStatusPanel"
                 Grid.Row="0"
                 Orientation="Horizontal"
                 Margin="10,3">
            <Label Text="{Binding Name}"
             Margin="5,0"/>
            <Label Text="{Binding LoadStatus}"
             TextColor="{Binding LoadStatus, Converter={StaticResource StatusToColor}}"/>
        </StackLayout>
        <StackLayout x:Name="SecureLayerStatusPanel"
                 Grid.Row="1"
                 Orientation="Horizontal"
                 Margin="10,3">
            <Label Text="{Binding Name}"
             Margin="5,0"/>
            <Label Text="{Binding LoadStatus}"
             TextColor="{Binding LoadStatus, Converter={StaticResource StatusToColor}}"/>
        </StackLayout>
        <esriUI:MapView x:Name="MyMapView"
                    Grid.Row="2"/>
    </Grid>
</ContentPage>


In this topic
  1. Code