This project showcases how to signup, login and authenticate a user with GO as a backend. The corresponding frontend flutter application can be found here.
Ensure you have the following prerequisites installed:
And an account for the following services:
- Clone the repository
- Create a
.env
file in the root directory and add the following variables:
JWT_KEY=YourSigningKey
ISS=guardianGate://Random String
AUD=guardianKey://Random String
API_KEY=YourAPIKey
MAIL_JET_API_KEY=YourMailJetAPIKey
MAIL_JET_SECRET_KEY=YourMailJetSecretKey
Note: JWT_Key, ISS, AUD, and API_Key can be any random string. Ensure they match between the Flutter app and the backend.
The MailJet API Key and Secret Key on the other hand can be found in your MailJet account.
- Run
go run main.go
to start the server on port 8081. - You can test the server with Postman or the Flutter App.
/auth/signup
- POST - Creates a new user/auth/signin
- POST - Logs in a user and returns a JWT/auth/sendActivationEmail
- POST - Verifies a users email address/auth/activateAccount
- POST - Activates a user's account
/exampleRestricted/exampleRestricted
- POST - Just a dummy route to test the authentication
This project is licensed under the MIT License - see the LICENSE file for details.