Tuesday, June 4, 2013

Register Client Id and Client Secret for Provider Hosted Sharepoint Apps


     Client Id and Client Secret is used to connect Window azure web sites / azure cloud services with Office 365 App (Provider Hosted Apps).
  1.      Generate Client Id and Client Secret from Sharepoint ( or Office 365) site
         Navigate to https://entc.sharepoint.com/_layouts/15/appregnew.aspx - this is office 365 site.     

         You need to generate AppId and App Secret and enter hosting domain and Redirect url.



          2.  Add Client Secret to App manifest (Sharepoint app --> AppManifest.xml , right click on it and select   "View Code")


           Put the Generated App ID in to Client ID Section


           3. Client Secret to Web.Config

         Then open the web config and put client secret and AppId to Web Config
     <appSettings>
       <add key="ClientId" value="ef07a76d-1df5-4831-8417-7f7a2778238a" />
       <add key="ClientSecret" value="U4urjkfT+jEhNAgIkCtM4Kl9uP6m9btx8oCvsb12KlA=" />
     </appSettings>

  4. Update ID and secret value in window azure Site

         We have to select the correct place to store these client Id and client Secret in window azure.
                
                a.       If the provider is Azure Web Site
                      Select the web site which we are going to host our site.Create new if you don’t have one


                    Then go to “CONFIGURE” à “App Settings”


b.       If the Provider is Azure Cloud Service
Then you need to remote login to the machine and put the web config manually.