Skip to content

Commit c3e171a

Browse files
eshanrnhgitbook-bot
authored andcommitted
GITBOOK-271: Fixed hyperlinks for Add Google Authentication (Users) - v14
1 parent 69b7ab9 commit c3e171a

File tree

1 file changed

+19
-33
lines changed

1 file changed

+19
-33
lines changed

14/umbraco-cms/tutorials/add-google-authentication.md

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
description: >-
3-
A tutorial on setting up Google authentication for the Umbraco CMS backoffice users.
3+
A tutorial on setting up Google authentication for the Umbraco CMS backoffice
4+
users.
45
---
56

67
# Add Google Authentication (Users)
@@ -21,9 +22,9 @@ We are sure a lot of content editors and implementors of your Umbraco sites woul
2122

2223
### What the tutorial covers
2324

24-
1. [Setting up a Google OAuth API](add-google-authentication.md#setting-up-a-google-oauth-api)
25-
2. [Integrating Google Auth in Visual Studio](add-google-authentication.md#integrating-google-auth-in-visual-studio)
26-
3. [Configuring the solution to allow Google logins](add-google-authentication.md#configuring-the-solution-to-allow-google-logins)
25+
1. [Setting up a Google OAuth API](add-google-authentication.md#id-1.-setting-up-a-google-oauth-api)
26+
2. [Integrating Google Auth in your project](add-google-authentication.md#id-2.-integrating-google-auth-in-your-project)
27+
3. [Configuring the solution to allow Google logins](add-google-authentication.md#id-3.-configuring-the-solution-to-allow-google-logins)
2728

2829
### Prerequisites
2930

@@ -39,22 +40,20 @@ The first thing to do is set up a Google API. To do this, you need to go to [htt
3940

4041
### Setup a Google Console Project
4142

42-
1. Click the project dropdown and select **New Project**.
43+
1. Click the project dropdown and select **New Project**.
4344

4445
![Project dropdown list](images/Project_dropdown_list_v13.png)
45-
4646
2. Enter a **Project name**, **Organization**, and **Location**.
4747
3. Click **Create**.
4848

4949
### Enable the Google+ API
5050

5151
1. Open the newly created project from the project dropdown.
52-
2. Click **Enable APIs and Services**.
52+
2. Click **Enable APIs and Services**.
5353

5454
![Enable APIs](images/Enable_Apis_v13.png)
55-
5655
3. Type **Google+ API** in the **Search** field.
57-
4. Select it and then **Enable** it.
56+
4. Select it and then **Enable** it.
5857

5958
![Enable Google APIs](images/Enable_Google_API_v13.png)
6059

@@ -64,10 +63,9 @@ Before you can create the credentials, you need to configure your consent screen
6463

6564
1. Click **OAuth consent screen** from the left-side navigation menu.
6665
2. Choose the **User Type** that fits your setup.
67-
3. Click **Create**.
66+
3. Click **Create**.
6867

6968
![Select User Type](images/User_Type_v13.png)
70-
7169
4. Fill in the required information:
7270
* App name
7371
* User support email
@@ -82,18 +80,17 @@ Before you can create the credentials, you need to configure your consent screen
8280

8381
1. Click **Credentials** from the left-side navigation menu.
8482
2. Click **Create Credentials**.
85-
3. Select **OAuth Client ID** from the dropdown.
83+
3. Select **OAuth Client ID** from the dropdown.
8684

8785
![Select OAuth Client ID](images/OAuth_Client_Id_v13.png)
88-
8986
4. Select **Web Application** from the **Application type** dropdown.
90-
5. Enter the following details:
91-
* Application **Name**
92-
* **Authorized JavaScript origins**
93-
* **Authorized redirect URIs**
87+
5. Enter the following details:
9488

95-
![Credentials](images/credentials_v13.png)
89+
* Application **Name**
90+
* **Authorized JavaScript origins**
91+
* **Authorized redirect URIs**
9692

93+
![Credentials](images/credentials_v13.png)
9794
6. Click **Create**.
9895

9996
A popup appears displaying the **Client Id** and **Client Secret**. You will need these values later while configuring your solution.
@@ -119,13 +116,12 @@ If you have cloned down an Umbraco Project, you will need to navigate to the `sr
119116
{% endhint %}
120117

121118
2. Open a command-line of your choice such as "Command Prompt" at the mentioned location.
122-
3. Run the following command to install the `Microsoft.AspNetCore.Authentication.Google` package.
119+
3. Run the following command to install the `Microsoft.AspNetCore.Authentication.Google` package.
123120

124121
```cli
125122
dotnet add package Microsoft.AspNetCore.Authentication.Google
126123
```
127-
128-
4. Once the package is installed, open the **.csproj** file to ensure if the package reference is added:
124+
4. Once the package is installed, open the **.csproj** file to ensure if the package reference is added:
129125
130126
```js
131127
<ItemGroup>
@@ -148,14 +144,12 @@ To use an external login provider such as Google on your Umbraco CMS project, yo
148144
* A Composer to tie it all together.
149145
* An Umbraco backoffice manifest declaration.
150146
151-
You can create these files in a location of your choice. In this tutorial, the files will be added to an `ExternalUserLogin/GoogleAuthentication` folder for the C# classes.
152-
You will also need an `\App_Plugins\my-auth-providers` folder location for the frontend registration.
147+
You can create these files in a location of your choice. In this tutorial, the files will be added to an `ExternalUserLogin/GoogleAuthentication` folder for the C# classes. You will also need an `\App_Plugins\my-auth-providers` folder location for the frontend registration.
153148
154149
1. Create a new class:`GoogleBackOfficeExternalLoginProviderOptions.cs`.
155150
2. Add the following code to the file:
156151
157152
{% code title="GoogleBackOfficeExternalLoginProviderOptions.cs" lineNumbers="true" %}
158-
159153
```csharp
160154
using Microsoft.Extensions.Options;
161155
using Umbraco.Cms.Api.Management.Security;
@@ -224,7 +218,6 @@ public class GoogleBackOfficeExternalLoginProviderOptions : IConfigureNamedOptio
224218
}
225219
}
226220
```
227-
228221
{% endcode %}
229222

230223
{% hint style="info" %}
@@ -237,7 +230,6 @@ Set the `autoLinkExternalAccount` to `false` in order to disable auto-linking in
237230
4. Add the following code to the file:
238231

239232
{% code title="GoogleBackOfficeAuthenticationOptions.cs" lineNumbers="true" %}
240-
241233
```csharp
242234
using Microsoft.AspNetCore.Authentication.Google;
243235
using Microsoft.Extensions.Options;
@@ -282,15 +274,12 @@ public class GoogleBackOfficeAuthenticationOptions : IConfigureNamedOptions<Goog
282274
}
283275

284276
```
285-
286277
{% endcode %}
287278

288279
5. Replace **YOURCLIENTID** and **YOURCLIENTSECRET** with the values from the **OAuth Client Ids Credentials** window. Or use the [IOptions pattern](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) to read the values from app settings (or other sources).
289-
290280
6. Register both `ConfigureNameOptions` into a composer and add the provider to Umbraco
291281

292282
{% code title="GoogleBackOfficeExternalLoginComposer.cs" lineNumbers="true" %}
293-
294283
```csharp
295284
using Umbraco.Cms.Api.Management.Security;
296285
using Umbraco.Cms.Core.Composing;
@@ -326,12 +315,11 @@ public class GoogleBackOfficeExternalLoginComposer : IComposer
326315
}
327316
}
328317
```
329-
330318
{% endcode %}
331319

332320
7. Register the provider with the backoffice client by adding the following file to the manifest file in `/App_Plugins/my-auth-providers/umbraco-package.json`:
333-
{% code title="/App_Plugins/my-auth-providers/umbraco-package.json" lineNumbers="true" %}
334321

322+
{% code title="/App_Plugins/my-auth-providers/umbraco-package.json" lineNumbers="true" %}
335323
```json
336324
{
337325
"$schema": "../../umbraco-package-schema.json",
@@ -351,14 +339,12 @@ public class GoogleBackOfficeExternalLoginComposer : IComposer
351339
}
352340

353341
```
354-
355342
{% endcode %}
356343

357344
8. Build and run the website.
358345
9. Log in to the backoffice using the Google Authentication option.
359346

360347
{% hint style="info" %}
361-
362348
If auto-linking is disabled, the user will need to follow these steps in order to be able to use Google Authentication:
363349

364350
1. Login to the backoffice using Umbraco credentials.

0 commit comments

Comments
 (0)