-
Notifications
You must be signed in to change notification settings - Fork 0
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
BE OAuth Configuration #858
Conversation
Learn about Next.js in an interactive course with quizzes! | ||
</p> | ||
</a> | ||
import { useEffect } from "react"; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
</p> | ||
</a> | ||
import { useEffect } from "react"; | ||
import { calendarAuthRedirect } from "@generatesac/lib"; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
const rootReducer = combineReducers({ | ||
user: userReducer, | ||
[baseApi.reducerPath]: baseApi.reducer, | ||
clubReducer: clubReducer, |
Check warning
Code scanning / CodeQL
Variable not declared before use Warning
declaration
user: userReducer, | ||
[baseApi.reducerPath]: baseApi.reducer, | ||
clubReducer: clubReducer, | ||
recruitmentReducer: recruitmentReducer, |
Check warning
Code scanning / CodeQL
Variable not declared before use Warning
declaration
A lot of stuff needs to be removed / moved around |
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.
you're cooking @alderwhiteford
} | ||
|
||
// Return the authorization URL: | ||
func (client OAuthClient) Authorize(db *gorm.DB, jwt auth.JWTClientInterface, userId *uuid.UUID) (*string, error) { |
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 probably be using pointer receivers over value receivers so we don't have to copy the config strings around
func (client OAuthClient) Authorize(db *gorm.DB, jwt auth.JWTClientInterface, userId *uuid.UUID) (*string, error) { | |
func (client *OAuthClient) Authorize(db *gorm.DB, jwt auth.JWTClientInterface, userId *uuid.UUID) (*string, error) { |
**/ | ||
func (client GoogleOAuthClient) AuthorizeURL(state string) string { | ||
return ( | ||
client.OAuthConfig.BaseURL + "/auth?" + |
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.
there might be a url builder utility we can use here. if not, we should probably prefer fmt.Sprintf over string concat
|
||
func CreateCalendarToken(db *gorm.DB, jwtClient auth.JWTClientInterface, userID *uuid.UUID) (*string, error) { | ||
// Generate CSRF token: | ||
csrfToken, err := jwtClient.GenerateToken(auth.Claims{ |
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.
to separate concerns on token generation and database transactions, the token should probably be generated in the service, then passed to this function as a string
@@ -246,4 +247,11 @@ CREATE TABLE IF NOT EXISTS verifications( | |||
|
|||
CREATE UNIQUE INDEX IF NOT EXISTS uni_verifications_token ON verifications USING btree ("token"); | |||
|
|||
CREATE TABLE IF NOT EXISTS user_calendar_token( |
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.
let's update the [id].down.sql to include a matching drop statement
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.
nit but we should split into files for google and outlook. including the associated request bodies there as well
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.
is there not an associated service and transactions? we should separate our concerns so integrations/oauth only handles the bespoke google/outlook requirements while we have our internal service and transaction logic in this package
didn't see this until after my review, sorry for redundant comments on this |
Description
[Link to Ticket](insert the link to your ticket inside the parenthesis here)
Please include a summary of the changes and the related issue. Please also
include relevant motivation, context, and images!
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. If they are unit
tests, provide the file name the tests are in. If they are not unit tests,
describe how you tested the change.
Checklist