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

Merged
merged 12 commits into from
Jul 30, 2025
Merged

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

@jankapunkt jankapunkt marked this pull request as ready for review July 30, 2025 07:20
@jankapunkt jankapunkt merged commit d09a1a0 into main Jul 30, 2025
@shrihari-prakash
Copy link
Collaborator Author

Ouch I thought it was about to be squashed and merged. I see that I pollluted the commit history of main branch. I shall keep this in mind and keep the commit history clean next time around :)

cc: @jankapunkt

@jankapunkt
Copy link
Member

Hey @shrihari-prakash sorry that was my bad, I plain merged instead of squash. Will also keep it in mind next time.

@shrihari-prakash
Copy link
Collaborator Author

shrihari-prakash commented Jul 30, 2025

Hey @shrihari-prakash sorry that was my bad, I plain merged instead of squash. Will also keep it in mind next time.

We could also settle on squashing or bringing the commits into main and follow it in all future PRs. On one hand, the details about the author who made the fix is lost when you squash which possibly makes it hard to keep track of contributors. Perhaps it is better to keep the commit history clean from the time of opening the PR (which I should have probably done lol)....

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