Skip to content

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

shrihari-prakash
Copy link
Collaborator

No description provided.

@shrihari-prakash
Copy link
Collaborator Author

@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!

app.use(express.static("public"));

const authServer = "http://localhost:8080";
const clientId = process.env.CLIENT_ID || "testclient";
Copy link
Collaborator Author

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.

Copy link
Member

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

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Member

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)

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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?

Copy link
Member

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

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