Monday, September 19, 2016

Invalid JWT token. Could not resolve issuer token.

For the second time in three years. I have had the pleasure of encounter a "Invalid JWT token. Could not resolve issuer token." Error. The error comes from a provider-hosted add-in which worked fine the day before. The last time I got the error, I ended up recreate my client ID and client secret both in SharePoint online and need to update my web.config. But this year I was keen on finding a solution! After some time to even understand the error message. I found this article "Replace an expiring client secret in a SharePoint Add-in" https://msdn.microsoft.com/en-us/library/office/dn726681.aspx. Article goes step-by-step how to update your client secret. I have updated the script, as I allready knew my add-in name.

#set the name of my add-in
$displayName = "governanceapp"
Connect-MsolService
$appentry = Get-MsolServicePrincipal -all  | ? { $_.DisplayName -eq $displayName}
$principalId = $appentry.AppPrincipalId
$bytes = New-Object Byte[] 32
$rand = [System.Security.Cryptography.RandomNumberGenerator]::Create()
$rand.GetBytes($bytes)
$rand.Dispose()
$newClientSecret = [System.Convert]::ToBase64String($bytes)
New-MsolServicePrincipalCredential -AppPrincipalId $principalId -Type Symmetric -Usage Sign -Value $newClientSecret
New-MsolServicePrincipalCredential -AppPrincipalId $principalId -Type Symmetric -Usage Verify -Value $newClientSecret
New-MsolServicePrincipalCredential -AppPrincipalId $principalId -Type Password -Usage Verify -Value $newClientSecret
#this go into the web.config
$newClientSecret

37 comments:

  1. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Aws Training in Chennai
    Advanced Aws Training in Chennai

    ReplyDelete
  2. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    Java training in Bangalore | Java training in Kalyan nagar

    Java training in Bangalore | Java training in Kalyan nagar

    Java training in Bangalore | Java training in Jaya nagar



    ReplyDelete
  3. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. 
    python course in pune
    python course in chennai
    python course in Bangalore

    ReplyDelete
  4. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. 

    angularjs Training in chennai

    angularjs Training in chennai

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    ReplyDelete
  5. Nice artilce on this.

    Thanks for sharing.
    http://trickycoder.com SharePoint Site

    ReplyDelete
  6. Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    ReplyDelete

  7. Easily, the article is actually the best topic on this registry related issue. I fit in with your Python classes in pune conclusions and will eagerly look forward to your next updates.

    ReplyDelete
  8. I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing.

    Upgrade your career Learn Data Warehousing Training in Bangalore from industry experts get Complete hands-on Training, Interview preparation, and Job Assistance at Softgen Infotech.

    ReplyDelete
  9. And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
    Digital Marketing Training in Chennai

    ReplyDelete
  10. I am impressed by the information that you have on this blog. It shows how well you understand this subject.

    data science course in malaysia
    best tableau training
    data analytics course malaysia
    360DigiTMG

    ReplyDelete
  11. Hey, thanks for this great article I really like this post and I love your blog and also Check IOT training in hyderabad at 360DIGITMG.
    360Digitmg IOT training in hyderabad

    ReplyDelete
  12. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.

    ai course in delhi

    ReplyDelete
  13. I think it could be more general if you get a football sports activitydata science course

    ReplyDelete
  14. Yeah, this article is actually one of the very best in articles literature. I am an ancient reader of 'Articles' and often I read new articles if I find them interesting. And this one I consider to be pretty interesting and should go into my set. Very strong labour!360DigiTMG data science course in malaysia

    ReplyDelete
  15. Effectively, the article is really the best point on this library related issue. I fit in with your decisions and will excitedly anticipate your next updates.artificial intelligence course in noida

    ReplyDelete
  16. Thanks for the information about Blogspot very informative for everyone
    data science course gurgaon

    ReplyDelete
  17. I need to thank you for this particularly fantastic article. I definitely really liked every part of it.Educational Institute in Visakhapatnam.

    ReplyDelete
  18. Thanks for Sharing this Valuable Information with us: this is very useful for me. Keep it Up.
    data science certification

    ReplyDelete
  19. Thanks For your post. This is rally helpful for Data science for beginner.
    machine learning course aurangabad

    ReplyDelete
  20. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    cyber security certification malaysia

    ReplyDelete
  21. Thank you so much for sharing such a knowledgeable post!I really like your blog. if you want to know about Python Visit:Python training in Lucknow

    ReplyDelete