{"id":23353617,"url":"https://github.com/jd297/insomnia-plugin-jd297-api-token-auto-refresh","last_synced_at":"2025-04-07T19:19:54.884Z","repository":{"id":63908429,"uuid":"571035453","full_name":"JD297/insomnia-plugin-jd297-api-token-auto-refresh","owner":"JD297","description":"Insomnia plugin that checks for an api token in response and saves it as a template variable.","archived":false,"fork":false,"pushed_at":"2022-11-28T19:34:52.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T20:48:59.015Z","etag":null,"topics":["insomnia","insomnia-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JD297.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-26T23:56:59.000Z","updated_at":"2025-01-21T12:41:28.000Z","dependencies_parsed_at":"2022-11-28T22:55:01.599Z","dependency_job_id":null,"html_url":"https://github.com/JD297/insomnia-plugin-jd297-api-token-auto-refresh","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Finsomnia-plugin-jd297-api-token-auto-refresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Finsomnia-plugin-jd297-api-token-auto-refresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Finsomnia-plugin-jd297-api-token-auto-refresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JD297%2Finsomnia-plugin-jd297-api-token-auto-refresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JD297","download_url":"https://codeload.github.com/JD297/insomnia-plugin-jd297-api-token-auto-refresh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713263,"owners_count":20983683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["insomnia","insomnia-plugin"],"created_at":"2024-12-21T09:14:33.788Z","updated_at":"2025-04-07T19:19:54.836Z","avatar_url":"https://github.com/JD297.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# insomnia-plugin-jd297-api-token-auto-refresh\n\n## Overview \u003ca name=\"overview\"\u003e\u003c/a\u003e\n\nInsomnia plugin that checks for an api token in response and saves it as a template variable.\n\n## Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n### Installation \u003ca name=\"installation\"\u003e\u003c/a\u003e\n\n#### Manual Installation\n1. Download \"insomnia-plugin-jd297-api-token-auto-refresh-{version}.zip\" from [Releases \u003e Assets](https://github.com/JD297/insomnia-plugin-jd297-api-token-auto-refresh/releases)\n2. Go to Application \u003e Preferences \u003e Plugins\n3. Click \"Reveal Plugins Folder\"\n4. Extract the ZIP file from step 1 to the \"plugins\" folder\n5. Click \"Reload Plugins\"\n\n### Configuration \u003ca name=\"configuration\"\u003e\u003c/a\u003e\n\n#### Manual Configuration\nUpdate your [environment](https://docs.insomnia.rest/insomnia/environment-variables/):\n1. Click \"Manage Environments\"\n2. Create a \"jd297-api-token-auto-refresh\" environment variable with the response key you need:\n\nDefault\n```json\n{\n  \"jd297-api-token-auto-refresh\": {\n    \"api_token_response_key\": \"token\"\n  }\n}\n```\n\nExample\n```json\n{\n  \"jd297-api-token-auto-refresh\": {\n    \"api_token_response_key\": \"access_token\"\n  }\n}\n```\n\n### Functionality \u003ca name=\"functionality\"\u003e\u003c/a\u003e\n\n#### Automatic token refresh\n\nCreate a request for an auth route. E.g.:\n\n```json\nPOST http://localhost:8000/api/oauth/token\n{\n    \"grant_type\": \"client_credentials\",\n    \"client_id\": \"...\",\n    \"client_secret\": \"...\"\n}\n```\n\nThe Plugin now looks for the \"api_token_response_key\" from our environment config in the response. If found the plugin\nsaves the data to a [Template Tag](https://docs.insomnia.rest/insomnia/template-tags). \nIf the token is not valid any more just send the auth request again and the Template Tag will be refreshed everywhere you used it.\n\n#### Template Tag\nNow create a [Bearer Token](https://docs.insomnia.rest/insomnia/authentication#bearer-token) authentication. \nIn the token field you can pass the Template Tag \"jd297ApiTokenAutoRefreshApiToken\". \n\n\n## Further Reading \u003ca name=\"further-reading\"\u003e\u003c/a\u003e\n\n* [Insomnia Plugins](https://docs.insomnia.rest/insomnia/introduction-to-plugins)\n* [The Insomnia Plugin Hub](https://insomnia.rest/plugins)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd297%2Finsomnia-plugin-jd297-api-token-auto-refresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjd297%2Finsomnia-plugin-jd297-api-token-auto-refresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjd297%2Finsomnia-plugin-jd297-api-token-auto-refresh/lists"}