Skip to content

Commit

Permalink
API Key updates (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
duffh authored Jul 15, 2024
1 parent 1dc721a commit 97a6986
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 46 deletions.
62 changes: 27 additions & 35 deletions src/MAUI/Maui.Samples/Views/ApiKeyView.xaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView
x:Class="ArcGIS.ApiKeyView"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ContentView x:Class="ArcGIS.ApiKeyView"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ContentView.Content>
<StackLayout Orientation="Vertical">
<Label x:Name="Instructions" Margin="5">
<Label.FormattedText>
<FormattedString>
<Span Text="Some content used in the samples requires a developer API key for access. Go to " />
<Span
Text="the developer documentation"
TextColor="Blue"
TextDecorations="Underline">
<Span.GestureRecognizers>
<TapGestureRecognizer Tapped="LinkTapped" />
</Span.GestureRecognizers>
</Span>
<Span Text=" to learn how to obtain a developer API key for ArcGIS Online." />
</FormattedString>
</Label.FormattedText>
</Label>
<StackLayout Orientation="Horizontal">
<HorizontalStackLayout Margin="5">
<Label Text="Some content used in the samples requires an API key to access ArcGIS location services. Go to " />
<Label Text="the developer documentation tutorial"
TextColor="Blue"
TextDecorations="Underline">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="LinkTapped" />
</Label.GestureRecognizers>
</Label>
<Label Text=" to create a new API key." />
</HorizontalStackLayout>
<Label Margin="5" Text="Ensure that your API key privileges include basemaps, geocoding and routing services to run all samples." />
<StackLayout Margin="5,0" Orientation="Horizontal">
<Label Text="Current API key:" />
<Label x:Name="CurrentKeyText" Margin="5,0,0,0" />
</StackLayout>
<Entry
x:Name="KeyEntryBox"
Margin="5"
Text="" />
<Entry x:Name="KeyEntryBox"
Margin="5"
Text="" />
<StackLayout Orientation="Horizontal">
<Button
x:Name="SetKeyButton"
Margin="5"
Clicked="SetKeyButton_Clicked"
Text="Set API key" />
<Button
x:Name="DeleteKeyButton"
Margin="5"
Clicked="DeleteKeyButton_Clicked"
Text="Delete API key" />
<Button x:Name="SetKeyButton"
Margin="5"
Clicked="SetKeyButton_Clicked"
Text="Set API key" />
<Button x:Name="DeleteKeyButton"
Margin="5"
Clicked="DeleteKeyButton_Clicked"
Text="Delete API key" />
</StackLayout>
<Label x:Name="Status" Margin="5,0,0,0" />
</StackLayout>
Expand Down
4 changes: 2 additions & 2 deletions src/MAUI/Maui.Samples/Views/ApiKeyView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ private void DeleteKeyButton_Clicked(object sender, EventArgs e)
Status.Text = "API key removed";
}

private void LinkTapped(object sender, EventArgs e)
private void LinkTapped(object sender, TappedEventArgs e)
{
Microsoft.Maui.ApplicationModel.Launcher.OpenAsync(new Uri("https://links.esri.com/arcgis-api-keys"));
Microsoft.Maui.ApplicationModel.Launcher.OpenAsync(new Uri("https://links.esri.com/create-an-api-key"));
}
}
}
7 changes: 4 additions & 3 deletions src/Samples.Shared/Managers/ApiKeyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ public static string ArcGISDeveloperApiKey
{
get
{
// An Application programming interface key (API key) is a unique identifier used to authenticate a user, developer, or calling program with a server portal.
// Typically, API keys are used to authenticate a calling program within the API rather than an individual user.
// Go to https://links.esri.com/arcgis-api-keys to learn how to obtain a developer API key for ArcGIS Online.
// An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items.
// You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the Generate API keys privilege.
// To learn how to create and manage API keys, go to the https://links.esri.com/create-an-api-key tutorial to create a new API key.
// You must ensure that your API key has the correct privileges to access secure resources.
return _key;
}

Expand Down
7 changes: 4 additions & 3 deletions src/WPF/WPF.Viewer/ApiKeyPrompt.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<TextBlock x:Name="Instructions"
Margin="5"
TextWrapping="Wrap">
Some content used in the samples requires a developer API key for access. Go to<Hyperlink NavigateUri="https://links.esri.com/arcgis-api-keys" RequestNavigate="Hyperlink_RequestNavigate">
the developer documentation
Some content used in the samples requires an API key to access ArcGIS location services. Go to <Hyperlink NavigateUri="https://links.esri.com/create-an-api-key" RequestNavigate="Hyperlink_RequestNavigate">
the developer documentation tutorial
</Hyperlink>
to learn how to obtain a developer API key for ArcGIS Online.</TextBlock>
to create a new API key.</TextBlock>
<TextBlock Margin="5" TextWrapping="Wrap" Text="Ensure that your API key privileges include basemaps, geocoding and routing services to run all samples." />
<StackPanel Orientation="Horizontal">
<Label Content="Current Api Key:" />
<TextBox x:Name="CurrentKeyText"
Expand Down
7 changes: 4 additions & 3 deletions src/WinUI/ArcGIS.WinUI.Viewer/ApiKeyPrompt.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
<TextBlock x:Name="Instructions"
Margin="5"
TextWrapping="Wrap">
Some content used in the samples requires a developer API key for access. Go to<Hyperlink NavigateUri="https://links.esri.com/arcgis-api-keys">
the developer documentation
Some content used in the samples requires an API key to access ArcGIS location services. Go to <Hyperlink NavigateUri="https://links.esri.com/create-an-api-key">
the developer documentation tutorial
</Hyperlink>
to learn how to obtain a developer API key for ArcGIS Online.</TextBlock>
to create a new API key.</TextBlock>
<TextBlock Margin="5" Text="Ensure that your API key privileges include basemaps, geocoding and routing services to run all samples." />
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5" Text="Current Api Key:" />
<TextBox x:Name="CurrentKeyText"
Expand Down

0 comments on commit 97a6986

Please sign in to comment.