# APNS with Vapor, in the .production environment

**URL:** <https://forums.kodeco.com/t/apns-with-vapor-in-the-production-environment/152505>\
**Category:** Server Side Swift with Vapor\
**Created:** [October 11, 2021, 11:43pm UTC](https://forums.kodeco.com/t/apns-with-vapor-in-the-production-environment/152505 "2021-10-11T23:43:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakesiciliano](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jakesiciliano/32/81494_2.png) [@jakesiciliano](https://forums.kodeco.com/u/jakesiciliano)\
**Post date:** [October 11, 2021, 11:43pm UTC](https://forums.kodeco.com/t/apns-with-vapor-in-the-production-environment/152505/1 "2021-10-11T23:43:52Z")

</div>

Hello!

I followed the guide, “Sending Push Notifications With Vapor” ([https://www.raywenderlich.com/11238593-sending-push-notifications-with-vapor](https://www.raywenderlich.com/11238593-sending-push-notifications-with-vapor)). I am looking to switch the environment to .production from .sandbox in the app.configuration portion. When I change it, errors are returned and I’m not sure why. Do you have a guide or resource for APNS in production?

The error returned is “badDeviceToken” when I send an APNS to a device registered in .production environment. This hadn’t happened when in the .sandbox environment. Thank you ahead of time for your help!

---

<div class="post-metadata">

**Author:** ![0xtim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/0xtim/32/111111_2.png) [@0xtim](https://forums.kodeco.com/u/0xtim)\
**Post date:** [October 15, 2021, 4:29pm UTC](https://forums.kodeco.com/t/apns-with-vapor-in-the-production-environment/152505/2 "2021-10-15T16:29:28Z")

</div>

Things are basically the same from the server point of view. You need a production certificate that’s configured for the prod environment but that’s about it. You also need to change things on the iOS side. It needs to be build for distribution and you need to request a new token in the app from the device that works with the prod environment

---

<div class="post-metadata">

**Author:** ![jakesiciliano](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jakesiciliano/32/81494_2.png) [@jakesiciliano](https://forums.kodeco.com/u/jakesiciliano)\
**Post date:** [October 16, 2021, 10:03pm UTC](https://forums.kodeco.com/t/apns-with-vapor-in-the-production-environment/152505/3 "2021-10-16T22:03:31Z")

</div>

OK, will try. It has returned that error each time I compile from XCode, not using a Test Flight instance of the app. I’ll try to push to Test Flight, thank you!
