Creating an QGIS OAuth2 Authentication Configuration
From your QGIS application, select Options from the Settings menu. Select the Authentication tab.
You may be asked to create a "Master Password" when you first create an authentication setup. If so, create a secure password there before continuing.
Save the linked the file named LCC GeoData QGIS Connection.xml from this link to a known location on your computer by downloading.
From the Utilities drop down menu (bottom right of dialogue box) select Import authentication configuration from file. Navigate to the save location for the above file, highlight and click open. You will be prompted to input a password, please insert LCCGIS.
You can close down the Options dialog now.
Adding the Connection Details
Lastly, we'll need to setup the server connection as an "ArcGIS Rest Server Connection" in QGIS. Accessed through the Layer menu. Click the "Add Layer", select “ArcGIS Rest Server Layer”, and then press "New" in the Server Connections group at the top of this dialog.
Enter a descriptive name for the connection, and then enter the connection URLs. These will vary depending on whether you're connecting to AGOL or an ArcGIS Portal server:
ArcGIS Online Connection-.05
URL: https://services-eu1.arcgis.com/WZPLjyOOFu4PQ3GJ/arcgis/rest/services/
Community endpoint URL: https://www.arcgis.com/sharing/rest/community
Content endpoint URL: https://www.arcgis.com/sharing/rest/content
Lastly, select the new OAuth2 configuration you just created under the "Authentication" group:
Click OK, and you're done!
Right Click on an empty portion of a tool bar and ensure that the browser panel is turned on.
In the browser panel, scroll down the find ArcGIS REST services and expand, you should see your new connection.
When you try to connect to the newly added connection, you'll automatically be taken to the AGOL or ArcGIS Portal's logon screen in order to authenticate with the service.
After entering your details, you'll then be connected securely to the server and will have access to all items which are shared with your user account!
You can also download a copy of these instructions from here.