-
Notifications
You must be signed in to change notification settings - Fork 4
Add example for Authorization Code grant. #9
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: main
Are you sure you want to change the base?
Conversation
@jankapunkt not sure if you find this too much for a sample. I tried to be as concise as possible, but please let me know if I can change something! |
authorization-code/client/index.js
Outdated
app.use(express.static("public")); | ||
|
||
const authServer = "http://localhost:8080"; | ||
const clientId = process.env.CLIENT_ID || "testclient"; |
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.
It would be nice if the sample worked just as is without any envs. So I added a default, but we can discuss the options.
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.
I think envs are fine, you can also use .env
if you like, it's a good common practice
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.
I did add both options. Use the values from the defaults if the env does not exist. But I am happy to remove the defaults if you prefer it to come only from the env.
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.
Or should we commit a .env
file with the defaults? Not like it contains secretive stuff... The intention being the samples work with as minimal effort as possible.
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.
common practice is to gitignore .env but provide a .env.example
that users can copy. This avoids ever checking in real .env (in case users build their project upon the example)
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.
or do not check in a .env
at all but tell users to create one with example data. My concerns are only regarding users cloning and continuing to use it until production.
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.
I added a .env.example
file. Seems to be a good balance incase they use it till production.
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.
@jankapunkt FYI I got the example to a runnable state. Would you be able to run this when you have some availability?
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.
@shrihari-prakash yes I will test it and leave comments/review if needed
No description provided.