-
Notifications
You must be signed in to change notification settings - Fork 6
jank oAuth implement #108
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
base: staging
Are you sure you want to change the base?
jank oAuth implement #108
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/bitproject/bit-next/dyw2tuk01 |
| db.init_app(app) | ||
| migrate.init_app(app, db) | ||
| jwt.init_app(app) | ||
| app.config['GITHUB_CLIENT_ID'] = '98574e099fa640413899' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should put the client secret and client id in the .env file
backend/conduit/user/views.py
Outdated
| #refactor and hide these | ||
|
|
||
| #NOTE: use try catch block later | ||
| payload = { 'client_id': "98574e099fa640413899", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace hard coded secrets with environment variables.
backend/conduit/user/views.py
Outdated
| user.token = create_access_token(identity=user, fresh=True) | ||
| return user | ||
|
|
||
| # Flask Migrate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erase any code/comments that you no longer need
components/profile/LoginForm.tsx
Outdated
| const code = new URLSearchParams(window.location.search).get("code"); | ||
| if (code){ | ||
| logging_in = (<p>Redirecting to home page...</p>); | ||
| React.useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import the useState function from react instead of React.useState. Makes the code more easy to read.
components/profile/LoginForm.tsx
Outdated
| </button> | ||
| </fieldset> | ||
| </form> | ||
| <a href="https://github.com/login/oauth/authorize?client_id=98574e099fa640413899&scope=user+repo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again use environment variables instead of hard coded values.
Implemented oAuth flow that connects with backend. Most github operations are performed in the backend to avoid third party interference. Have to refactor: