Skip to content
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

/v1/user/detail returns information about the current user. #470

Closed
wolfsilver opened this issue Jan 23, 2025 · 1 comment
Closed

/v1/user/detail returns information about the current user. #470

wolfsilver opened this issue Jan 23, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@wolfsilver
Copy link

/v1/user/detail requires the id parameter.
If don't have an id, could return information about the current user?

I've added a connection to telegram to hopefully get current user information based on a token
https://github.com/wolfsilver/blinko-telegram

Image

Copy link

dosubot bot commented Jan 23, 2025

Hey @wolfsilver! I'm here to assist you with bug fixes, answer your questions, and guide you on becoming a contributor. Let's work together to resolve any issues you encounter.

To fetch the current user's information without an ID using a token, you can leverage the existing authentication service in the Blinko codebase. The getToken function in src/server/routers/helper/index.ts retrieves a token and can extract user information from it. This function uses the next-auth/jwt package to handle token extraction:

export const getToken = async (req: NextApiRequest | NextRequest) => {
  const secret = await getNextAuthSecret();
  return await getNextAuthToken({ req, secret }) as User;
}

You can modify the /v1/user/detail endpoint to use this function to obtain the current user's details based on the token, instead of requiring an ID [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the enhancement New feature or request label Jan 23, 2025
blinko-space added a commit that referenced this issue Jan 27, 2025
- Updated user detail retrieval to handle optional user ID
- Enhanced error handling for user registration and update
- Refined error codes for username conflicts
- Simplified user creation and update validation checks

These changes improve the robustness of user authentication and registration processes.#
github-actions bot pushed a commit that referenced this issue Jan 27, 2025
## [0.37.17](v0.37.16...v0.37.17) (2025-01-27)

### Bug Fixes

* /v1/user/detail returns information about the current user. [#470](#470) ([613a2ce](613a2ce))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants