Contributing
We're so excited you're interested in helping with Authorizer. We are happy to help you get started, even if you don't have any previous open-source experience.
New to Open Source?
- Take a look at How to Contribute to an Open Source Project on GitHub
- Go through the Authorizer Code of Conduct
Where to ask questions?
- Check our Github Issues to see if someone has already answered your question.
- Join our community on Discord and feel free to ask us your questions
As you gain experience with Authorizer, please help answer other people's questions.
What to work on?
You can get started by taking a look at our Github issues If you find one that looks interesting and no one else is already working on it, comment on that issue and start contributing.
Please ask as many questions as you need, either directly in the issue or on Discord. We're happy to help.
Contributions that are ALWAYS welcome
- More tests
- Improved Docs
- Improved error messages
- Educational content like blogs, videos, courses
Development Setup
Prerequisites
- OS: Linux or macOS or windows
- Go: Golang >= v1.15
Project Setup for Authorizer core
- Fork the authorizer repository (Skip this step if you have access to repo)
git clone https://github.com/authorizerdev/authorizer.gitcd authorizercp .env.sample .env. Check all the supported env here- Build the code
make clean && makeNote: if you don't have
make, you cancdintoserverdir and build using thego buildcommand - Run binary
./build/server
Testing
Make sure you test before creating PR.
If you want to test for all the databases that authorizer supports you will have to run mongodb & arangodb instances locally.
Setup mongodb & arangodb using Docker
docker run --name mongodb -d -p 27017:27017 mongo
docker run --name arangodb -d -p 8529:8529 -e ARANGO_ROOT_PASSWORD=root arangodb/arangodb:3.8.4
Note: If you are not making any changes in db schema / db operations, you can disable those db tests here
If you are adding new resolver,
- create new resolver test file here
Naming convention filename:
resolver_name_test.gofunction name:resolverNameTest(s TestSetup, t *testing.T) - Add your tests here
Command to run tests:
make test
Manual Testing:
For manually testing using graphql playground, you can paste following queries and mutations in your playground and test it
mutation Signup {
signup(
params: {
email: "lakhan@yopmail.com"
password: "test"
confirm_password: "test"
given_name: "lakhan"
}
) {
message
user {
id
family_name
given_name
email
email_verified
}
}
}
mutation ResendEamil {
resend_verify_email(
params: { email: "lakhan@yopmail.com", identifier: "basic_auth_signup" }
) {
message
}
}
query GetVerifyRequests {
_verification_requests {
id
token
expires
identifier
}
}
mutation VerifyEmail {
verify_email(params: { token: "" }) {
access_token
expires_in
user {
id
email
given_name
email_verified
}
}
}
mutation Login {
login(params: { email: "lakhan@yopmail.com", password: "test" }) {
access_token
expires_in
user {
id
family_name
given_name
email
}
}
}
query GetSession {
session {
access_token
expires_in
user {
id
given_name
family_name
email
email_verified
signup_methods
created_at
updated_at
}
}
}
mutation ForgotPassword {
forgot_password(params: { email: "lakhan@yopmail.com" }) {
message
}
}
mutation ResetPassword {
reset_password(
params: { token: "", password: "test", confirm_password: "test" }
) {
message
}
}
mutation UpdateProfile {
update_profile(params: { family_name: "samani" }) {
message
}
}
query GetUsers {
_users {
id
email
email_verified
given_name
family_name
picture
signup_methods
phone_number
}
}
mutation MagicLinkLogin {
magic_link_login(params: { email: "test@yopmail.com" }) {
message
}
}
mutation Logout {
logout {
message
}
}
mutation UpdateUser {
_update_user(
params: {
id: "dafc9400-d603-4ade-997c-83fcd54bbd67"
roles: ["user", "admin"]
}
) {
email
roles
}
}
mutation DeleteUser {
_delete_user(params: { email: "signup.test134523@yopmail.com" }) {
message
}
}