[printicon align="left"]

Generate a New Client ID and Client Secret

This guide will walk you through how to generate a new Wizdom app with associated client id, and client secret if the client secret has expired.

Expired Client Secret

If a Wizdom app stops working because the client secret is expired, you will typically experience the two following errors:

1) In Wizdom Configuration Center, you will be met by the following error message.

Wizdom Digital Workplace
2) When this issue arises you will also experience that no Wizdom web parts works at the intranet. The web parts will keep loading, but not manage to show any content. 
The client secret for an app in Office 365 is typically valid for a year after the Wizdom app is created. After this, the client secret will automatically expire and the Wizdom app can no longer be used. You can renew your client secret in simple steps before it expires, in this way you want have to create a new Wizdom app. However, if the client secret is already expired, you’ll have to create a new Wizdom app with associated client id and secret. Below, we will walk you through the steps to do this.

Prerequisites

Before you start, you’ll need the following:

1) Microsoft Online Services Sign-In Assistant will have to be installed on the development computer. Download it here (32bit or 64bit)

2) SharePoint Online Management Shell will have to be installed on the development computer. Download it here

3) A tenant administrator user for the Office 365 tenant.

1) Generate New Client ID and Client Secret

First step is to generate a new client id and secret for the new app.

1) Go to the root site collection where the current app is installed and navigate to: https://<tenantsiteURL>.sharepoint.com/_layouts/15/appregnew.aspx or if using managed path for Wizdom, go to https://<tenantsiteURL>.sharepoint.com/sites/<wizdom>/_layouts/15/appregnew.aspx

2) Click generate for both the ‘Client id’ and ‘Client Secret’.

3) Fill in the ‘Title’ of the app. You decide the name, e.g. you can call it Wizdom.

4) In the ‘App Domain’ field’, you fill in the app domain name, typically ‘nameofyourorganization.azurewebsites.net’.

5) In the ‘Redirect URL’ field you, fill in the URL of the Wizdom app domain. Remember to use ‘https://’ before the URL, e.g. ‘https://nameofyourorganization.azurewebsites.net’.

Wizdom Digital Workplace
When you click ‘Create’ to finish, you generate a new client id and secret. Copy these to Notepad.

2) Update the New Client ID and Secret in Azure

Now, you’ll need to update the client id and secret for the Wizdom app in Azure.

1) Go to https://portal.azure.com/ and log in to find the Wizdom Azure website. If you have more than one Wizdom app, you’ll need to find the Wizdom Azure website with the same URL that you filled in the ‘Redirect URL’ field in step 1.5.

2) Go to ‘Applications settings’.

3) Replace the client id and client secret with the new values generated in step 1 and click ‘Save’. (as a precautionary measure, you can copy the old client id and secret to Notepad, before you replace them).

Wizdom Digital Workplace

3) Delete the Old App from the Intranet and the App Catalog

Before you can generate and add a new app, that uses the new client id and secret, the old Wizdom app must be deleted. This will have to be done in the relevant site collection as well as in the app catalog.

1) First, go to ‘Site contents’ for the site collection and remove the Wizdom app by clicking the three dots and then REMOVE. It can take a while for the app to be removed.

Wizdom Digital Workplace
2) Next click on the Settings menu and select Site Settings

3) In the Site Collection Administration section, select Recycle bin (_layouts/15/AdminRecycleBin.aspx)

4) Select the app and click on Delete Selection 

5) On the same page, click second-stage recycle bin 

6) Finally in the second-stage recycle bin, select the app and click on Delete Selection

7) Now, the app will have to be deleted from the app catalog. Open the app launcher and click the ‘Admin’ icon to go to the Office 365 Admin Center. 

Wizdom Digital Workplace
4) From here, click ‘SharePoint’ under ‘Admin centers’ to go to the ‘SharePoint admin center’.
Wizdom Digital Workplace
5) In the SharePoint admin center, click ‘apps’ in the left menu and then ‘App Catalog’ to go to the App Catalog.
Wizdom Digital Workplace
6) Click ‘Apps for SharePoint’ in the left menu. Here you’ll find a list of SharePoint apps. Find the app that you want to delete (same URL that you filled in the Redirect URL field in step 1.5.), mark it, and press your keyboard’s delete button.
Wizdom Digital Workplace
7) Finallly, delete the app from the Admin Recycle Bin by following the procedure in step 3.2.

4) Create a New App with PowerShell

Now, you’ll need to create a new Wizdom app.

This is done by running a PowerShell script named ‘GenerateAppPackage.ps1’ and is found in this zipped folder.

1) Download the zip-file and extract the content.

2) To execute the script in the file, in ???program???, first navigate to this folder. To navigate to the folder in ???program??? write: cd ”” (remember double quotes). After this, execute the script as follows:

 

Wizdom Digital Workplace
3) You replace the parameters with the respective values (the new client id from earlier, app URL (same URL that you filled in the ‘Redirect URL’ field in step 1.5), and app name (same name that you filled in the ‘Title’ field in step 1.3). The three last parameters [i brackets] are optional and only used if more apps have the same name.

To make a new GUID in PowerShell, run the following command:

[guid]::NewGuid()
This command generates an app file in the same folder as the PS1 file.

5) Upload the New App to the App Catalog

Now, you will upload the app file you’ve just created to the app catalog. This can easily be done by the means of drag and drop.
Wizdom Digital Workplace
Check, in the column to the right, that the app is valid.
Wizdom Digital Workplace

6) Add the New Wizdom App to the Intranet

Finally, you add the app to the site collection where you need the Wizdom functionality.

1) The easiest way to do this is by clicking ‘Add an app’ from the settings wheel.

Wizdom Digital Workplace
2) In the left menu of the page, under ‘Apps You Can Add’ click ‘From Your Organization’. Find the new Wizdom app, click on it and click ‘Trust it’.
Wizdom Digital Workplace

3) If it doesn’t allow you to trust it, you can send an approval request in the SharePoint dialog that appears. The admin now has to approve it here: https://<tenant>.sharepoint.com/sites/apps/AppRequests/ActiveRequests.aspx

Once approved, you are able to add the app again and press ‘Trust it’.

 

4) If the admin cannot approve the app and only sees the requested item, then go here https://<tenant>-admin.sharepoint.com/_layouts/15/appinv.aspx, find the App you just registered (client ID) and paste the following into the bottom text area and press ‘Create’.

<AppPermissionRequests AllowAppOnlyPolicy="true" >
 <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
 <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="FullControl" />
 <AppPermissionRequest Scope="http://sharepoint/search" Right="QueryAsUserIgnoreAppPrincipal" />
 <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
 <AppPermissionRequest Scope="http://sharepoint/taxonomy" Right="Write" />
 <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
</AppPermissionRequests>

5) If this doesn’t allow you to add the App, then the Tenant Admin must use the App Approval link, that is sent in the request mail.
This will trigger the correct workflow, and you can now approve the App.

You can now add the App.

 

That’s it!

Now go to the intranet front page and make sure that all Wizdom web parts work. Also, test the Wizdom app by going to Wizdom Configuration Center and confirm that everything work well in there as well.

If you encounter errors, then double-check that you have followed all steps in this guide thoroughly. Optionally, you can try and add the Wizdom app once again or to reinstall the app in the app catalog.

If Wizdom’s web parts still doesn’t work after this, but Wizdom Configuration Center opens and loads correctly, then try and go to the ‘Installation’ module in the ‘Admin’ part of Wizdom Configuration Center and click ‘Install’. This will make Wizdom try to reinstall the scriptloader on the current site collection and in some cases this can solve the issue.

If you have Wizdom installed on multiple site collections, and rather not want to install Wizdom on each and every site collection one by one, you can force an update of all site collections by adding a new dummy custom module in the ‘Custom Module’ part of Wizdom Configuration Center and then delete it again afterwards.

If Wizdom’s web parts are still not working after these actions, a reason can be that SharePoint has cached the expired client id/secret. This caching can last up till 12 hours and you will simply have to wait to find out whether this was the issue.

[printicon align="left"]