Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/auth #49

Draft
wants to merge 66 commits into
base: dev
Choose a base branch
from
Draft

feat/auth #49

wants to merge 66 commits into from

Conversation

pmoieni
Copy link
Contributor

@pmoieni pmoieni commented Apr 7, 2023

  • regenerate sqlc files
  • initial auth setup

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change

Fixes # (issue)
Dependent # (issue)

Current status

  • Waiting for review
  • Waiting for comment resolution
  • Waiting for merge
  • Draft
  • Trivial PR (nominal cosmetic/typo/whitespace changes)

Semantic Versioning

Please delete options that are not relevant. Ensure same has been covered in the commit message as well.

  • This is a fix change
  • This is a feat change
  • This is a BREAKING CHANGE

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Automated

Manual

Checklist:

  • My commit message mentions fix, feat, BREAKING CHANGE accordingly to increase the semantic versioning
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have checked my code/docs and corrected any misspellings

@pmoieni
Copy link
Contributor Author

pmoieni commented Apr 7, 2023

to run:

  • make a file with the name rmx.config.yaml inside the project root folder.
  • then write these inside the config file:
port: "8080"
db:
    host: localhost
    port: "3306"
    name: rmx-dev-test
    user: rmx
    password: postgrespw
auth:
    enable: true
    google:
        client_id: <CLIENT_ID>
        client_secret: <CLIENT_SECRET>
    cookie_key: <COOKIE_KEY>
dev: true
  • replace the <CLIENT_ID> and <CLIENT_SECRET> with your API credentials from google cloud console.

Note: set the callback URI to http://localhost:8000/auth/google/callback

  • replace <COOKIE_KEY> with a long secret key to encrypt cookies.
  • now start the server: go run ./cmd/cli/main.go dev

Note: make sure you run the server on port 8000, otherwise you need to change the code manually to handle the callback on your desired port.

  • Press y to read from the config file.

visit http://localhost:8000/v0/auth/google to login. now you may see your Google account info.

internal/auth/provider/github/github.go Outdated Show resolved Hide resolved
internal/auth/provider/github/github.go Outdated Show resolved Hide resolved
internal/auth/provider/github/github.go Outdated Show resolved Hide resolved
internal/auth/provider/github/github.go Outdated Show resolved Hide resolved
internal/cmd/run.go Outdated Show resolved Hide resolved
Copy link
Contributor

@harveysanders harveysanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure looks fine to me. However, there are a few issues stemming from moving the migration files. We'll either need to move them back or update the sqlc config and test migration file paths.

internal/auth/http/service.go Outdated Show resolved Hide resolved
internal/auth/http/service.go Outdated Show resolved Hide resolved
internal/jobq/queue.go Outdated Show resolved Hide resolved
sqlc.yaml Outdated Show resolved Hide resolved
pmoieni added a commit that referenced this pull request Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants