Share via


Notification hubs and the dreaded RegistrationAuthorizationException

I’ve been playing around with the awesome Windows Mobile Services and Notification Hubs in Windows Azure.

I ran into a problem recently where I couldn’t register for a native notification using Notification Hubs in my Windows Phone app and looking around for a resolution I came across someone else having this exact same issue:

https://social.msdn.microsoft.com/Forums/windowsazure/en-US/d43b0b6d-6c91-4891-8344-ea2a155092de/notification-hubs-call-registernativeasync-returns-registrationauthorizationexception-401?forum=servbus

Luckily for me, since I work at Microsoft, I have a wealth of resources at my fingertips, so I started by asking the team that develops it!

Well, as it turns out, the problem is the Windows Phone emulator and how it sets it’s clock and how often it syncs with the pc to keep that up to date. In turns out, when you try to register for a notification, a security token is generated from the client SDK and if the time settings are different you might be unauthorized, hence the exception I was seeing.

Once I manually set the clock in the emulator, everything started working fine. Problem solved!

I hope this helps you if you ever run into this issue.

Comments

  • Anonymous
    June 05, 2014
    How did you set the clock in the emulator? Without this, your advice isn't useful

  • Anonymous
    November 20, 2014
    I got the same error on a WinPhone 8.1 device. How this problem can be solved?

  • Anonymous
    May 09, 2015
    You can set the clock in the emulator by going to "Settings" then "date+time" and there you can change the time.