-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add /auth/token endpoint for service to exchange secret for api token #656
base: main
Are you sure you want to change the base?
Add /auth/token endpoint for service to exchange secret for api token #656
Conversation
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.
Create work, just small things which I thing should be adjusted.
|
||
if (newToken !== undefined) { | ||
reply.headers['x-auth-token'] = newToken | ||
} else { | ||
request.log.error('No user found') | ||
request.log.error('Could not create new token for user', user) |
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.
newToken can have the value undefined if the current token is still valid for longer than 15min, in that case it is not necessary to provide a new token. So catching the case that the token is undefined as an error is wrong here.
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.
aaaaah good catch
} | ||
} | ||
) | ||
app.post( |
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.
Great work🚀
|
||
interface Userinfo { | ||
interface GithubUserinfo { |
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.
Not happy with this name as the user info acts both for github users and non-github clients, so keeping the more general name userinfo might be better, also that one is not perfect. But, to fully fix this we would have to separate real users and clients.
}) | ||
|
||
const token = (await response.json()).token | ||
console.log(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.
can be removed before merge
Fix client missing client authentication
API_SECRET
currently)bot: boolean
field in User entityCloses #653