Add JSON response format to access token creation#2662
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a JSON API response to My::AccessTokensController#create so clients can create a new personal access token programmatically (returning 201 Created with the token details) in addition to the existing HTML redirect-based flow.
Changes:
- Add
respond_tohandling inMy::AccessTokensController#createto render token details as JSON on success. - Add integration tests covering token creation via JSON using both session-cookie auth and Bearer-token auth.
- Document the new access-token creation endpoint (with curl examples) in
docs/API.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
app/controllers/my/access_tokens_controller.rb |
Adds JSON response path for token creation while preserving HTML redirect behavior. |
test/controllers/my/access_tokens_controller_test.rb |
Adds tests for JSON token creation via session cookie and via Bearer token. |
docs/API.md |
Adds documentation and examples for creating access tokens via the API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1cd46d3 to
6a4ac69
Compare
Allows programmatic clients (e.g., CLI) to create access tokens via the API by returning the token, description, and permission as JSON instead of redirecting to the HTML show page.
Allows programmatic clients (e.g., CLI) to create access tokens via the API by returning the token, description, and permission as JSON instead of redirecting to the HTML show page.
6a4ac69 to
a65455b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
respond_toblock toMy::AccessTokensController#createto return token details as JSON (201 Created) alongside the existing HTML redirect flowdocs/API.mdwith examples for both auth methods