I want to use my access token, not an API key. When I try to use my access token, it simply tells me “Internal server error” and nothing else. Every field works fine if I use the API key, but not the access_token I generated.
How should I handle this at scale?
How can I allow a user to sign in with Jira, and then create issues without having to create or paste an API key? Or is that the way I should allow my users to integrate with Jira, by enabling a way for them to paste their API key?
Any advice would be helpful. I’m trying to achieve the best possible user experience.
I took a glance at your other community post, and it seems like you’re still trying to use Basic auth in the header; however, in the case of user impersonation, you need to set the authorization headers to use Bearer.
GET /rest/api/latest/myself HTTP/1.1
Host: {your-registered-instance}.atlassian.net
Accept: application/json
Authorization: Bearer {your-access-token}
And I already have the access_token from my oauth implementation which is this link: https://auth.atlassian.com/authorize?audience=api.atlassian.com&client_id=<CLIENT_ID>&scope=read:me%20read:account%20write:jira-work&redirect_uri=http://localhost:8787/auth/callback/atlassian&response_type=code&prompt=consent`}
If you’re getting an access_token back, then indeed! You’re on the right track. Looking at your community post, I believe you said that you could get a create issue (POST) request to work perfectly fine in Postman with basic auth (with your personal API token), but with the exact same request, with authorization set with Bearer token, you’re getting an internal server error. Is that right? Just want to make sure I’m not conflating your code attempt at making the request with the Postman request.
Use https://api.atlassian.com/oauth/token/accessible-resources to request the cloudId and use the bearer token on https://api.atlassian.com/ex/jira/<cloudId>/rest/api/3/issue to make the request.