# SMS user authentication with Vapor and AWS | raywenderlich.com

**URL:** <https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761>\
**Category:** 🎓 Courses & Articles\
**Created:** [January 7, 2020, 10:41am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761 "2020-01-07T10:41:23Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![natanrolnik](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/natanrolnik/32/108522_2.png) [@natanrolnik](https://forums.kodeco.com/u/natanrolnik)\
**Post date:** [January 7, 2020, 10:41am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/1 "2020-01-07T10:41:23Z")

</div>

In this SMS user authentication tutorial you will learn how to use AWS and Vapor to authenticate your users with their phone number.

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/4379841-sms-user-authentication-with-vapor-and-aws](https://www.raywenderlich.com/4379841-sms-user-authentication-with-vapor-and-aws)

---

<div class="post-metadata">

**Author:** ![jorge\_mz](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jorge_mz/32/105896_2.png) [@jorge\_mz](https://forums.kodeco.com/u/jorge_mz)\
**Post date:** [January 7, 2020, 4:38pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/2 "2020-01-07T16:38:18Z")

</div>

Not Working, more info, "How get _AWS\_KEY\_ID_ and _AWS\_SECRET\_KEY_ ", all the configuration of AWS for this project sample.

---

<div class="post-metadata">

**Author:** ![natanrolnik](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/natanrolnik/32/108522_2.png) [@natanrolnik](https://forums.kodeco.com/u/natanrolnik)\
**Post date:** [January 7, 2020, 9:11pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/3 "2020-01-07T21:11:13Z")

</div>

Hey @jorge_mz.

To begin with, you’ll need an AWS account. If you already have one, of after creating it, [check this guide](https://docs.aws.amazon.com/sns/latest/dg/sns-authentication-and-access-control.html) and the additional links there to see how to get the key id and the secret key, either for the root account or the IAM user. You need to make sure that these credentials have permission to access the SNS resources.

Once these are set up, you can start the tutorial.

---

<div class="post-metadata">

**Author:** ![jorge\_mz](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jorge_mz/32/105896_2.png) [@jorge\_mz](https://forums.kodeco.com/u/jorge_mz)\
**Post date:** [January 8, 2020, 2:31am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/4 "2020-01-08T02:31:46Z")

</div>

I get, key id and the secret key, for un user no root, but I get an error "**… is not authorized to perform: SNS:Publish on resource: +51973912122 (ErrorMiddleware.swift:26)**".  
The IAM user, have, AmazonSNSFullAccess (AWS managed policy)

---

<div class="post-metadata">

**Author:** ![natanrolnik](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/natanrolnik/32/108522_2.png) [@natanrolnik](https://forums.kodeco.com/u/natanrolnik)\
**Post date:** [January 8, 2020, 9:37am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/5 "2020-01-08T09:37:57Z")

</div>

@jorge_mz could you please paste here the contents of the policy? It might be that we’re missing something.

---

<div class="post-metadata">

**Author:** ![jorge\_mz](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jorge_mz/32/105896_2.png) [@jorge\_mz](https://forums.kodeco.com/u/jorge_mz)\
**Post date:** [January 8, 2020, 1:45pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/7 "2020-01-08T13:45:28Z")

</div>

I have this.  
 ![Captura de Pantalla 2020-01-08 a la(s) 08.43.21](https://files.chunter.kodeco.com/original/3X/c/7/c7b5a64415cadcbaffbb50ff003e859e73d818ec.png)

---

<div class="post-metadata">

**Author:** ![jorge\_mz](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jorge_mz/32/105896_2.png) [@jorge\_mz](https://forums.kodeco.com/u/jorge_mz)\
**Post date:** [January 8, 2020, 4:01pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/8 "2020-01-08T16:01:10Z")

</div>

Gracias Natan, ya esta funcionando. Yujuuuuu…

---

<div class="post-metadata">

**Author:** ![utility\_monst3r](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/utility_monst3r/32/87778_2.png) [@utility\_monst3r](https://forums.kodeco.com/u/utility_monst3r)\
**Post date:** [January 13, 2020, 7:08pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/9 "2020-01-13T19:08:43Z")

</div>

SMS is not recommended for 2FA because of security risks both in SS7 vulnerabilities and SIM swapping, and is no longer recommended by NIST. It’s only kind-of okay because an attacker would still need your password (and it’s better than no 2FA).

Your phone number is also not something that is necessarily consistent throughout your life, you could potentially change it and it could be given to someone else.

Using SMS as your only authentication means sounds like a poor security practice.

(the content of the article in general though was very good)

---

<div class="post-metadata">

**Author:** ![alif](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/alif/32/102075_2.png) [@alif](https://forums.kodeco.com/u/alif)\
**Post date:** [March 13, 2020, 3:42pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/10 "2020-03-13T15:42:15Z")

</div>

how we can add JWT with this article thanks

---

<div class="post-metadata">

**Author:** ![alif](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/alif/32/102075_2.png) [@alif](https://forums.kodeco.com/u/alif)\
**Post date:** [March 18, 2020, 7:01am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/11 "2020-03-18T07:01:16Z")

</div>

Will you update this project with Vapor 4 ?

---

<div class="post-metadata">

**Author:** ![natanrolnik](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/natanrolnik/32/108522_2.png) [@natanrolnik](https://forums.kodeco.com/u/natanrolnik)\
**Post date:** [March 19, 2020, 12:47pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/12 "2020-03-19T12:47:19Z")

</div>

Yes, we will probably update the posts in the weeks following Vapor 4 gets out of RC.

---

<div class="post-metadata">

**Author:** ![proxpero](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/proxpero/32/106824_2.png) [@proxpero](https://forums.kodeco.com/u/proxpero)\
**Post date:** [August 7, 2020, 1:39pm UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/13 "2020-08-07T13:39:22Z")

</div>

This wouldn’t work for me until I added a second message attribute: “AWS.SNS.SMS.SMSType” which has a value of type `SNS.MessageAttributeValue` with a `stringValue` property of “Transactional”. (ie I created an additional entry in the `messageAttributes` dictionary in the `AWSSNSSender` class initializer.)

(default is “Promotional”, which I couldn’t get to work even from the AWS console) “Transactional” is suitable for “one-time passcodes” per [AWS docs](https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html)

---

<div class="post-metadata">

**Author:** ![danurigom](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/danurigom/32/81494_2.png) [@danurigom](https://forums.kodeco.com/u/danurigom)\
**Post date:** [September 4, 2020, 12:45am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/14 "2020-09-04T00:45:59Z")

</div>

Hi Nathan, can you update this project please to Vapor 4? Thanks thanks!

---

<div class="post-metadata">

**Author:** ![natanrolnik](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/natanrolnik/32/108522_2.png) [@natanrolnik](https://forums.kodeco.com/u/natanrolnik)\
**Post date:** [October 15, 2020, 8:29am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/15 "2020-10-15T08:29:39Z")

</div>

Hi @danurigom and @alif

This post was updated to Vapor 4 and you can find it here:

[https://www.raywenderlich.com/13508424-sms-user-authentication-with-vapor-and-aws](https://www.raywenderlich.com/13508424-sms-user-authentication-with-vapor-and-aws)

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 6, 2021, 6:33am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/16 "2021-04-06T06:33:30Z")

</div>

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 6, 2021, 6:33am UTC](https://forums.kodeco.com/t/sms-user-authentication-with-vapor-and-aws-raywenderlich-com/93761/17 "2021-04-06T06:33:38Z")

</div>

Closed on April 6, 2021, 6:33am UTC


