{"id":27206818,"url":"https://github.com/sample-by-jsakamoto/blazor-allownoauthhttprequest","last_synced_at":"2026-04-28T11:01:46.766Z","repository":{"id":147941855,"uuid":"270665240","full_name":"sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest","owner":"sample-by-jsakamoto","description":"This repository describes how to send HTTP requests to the anonymously accessible endpoint without access token on an authentication enabled Blazor Wasm App.","archived":false,"fork":false,"pushed_at":"2020-06-08T12:59:14.000Z","size":313,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T23:55:42.773Z","etag":null,"topics":["authorization","blazor","blazor-client","blazor-client-side","blazor-webassembly"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sample-by-jsakamoto.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-08T12:46:01.000Z","updated_at":"2020-09-07T07:09:30.000Z","dependencies_parsed_at":"2023-05-28T02:00:33.190Z","dependency_job_id":null,"html_url":"https://github.com/sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-AllowNoAuthHttpRequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-AllowNoAuthHttpRequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-AllowNoAuthHttpRequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-AllowNoAuthHttpRequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sample-by-jsakamoto","download_url":"https://codeload.github.com/sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-AllowNoAuthHttpRequest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32377599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T09:24:15.638Z","status":"ssl_error","status_checked_at":"2026-04-28T09:24:15.071Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["authorization","blazor","blazor-client","blazor-client-side","blazor-webassembly"],"created_at":"2025-04-09T23:55:41.961Z","updated_at":"2026-04-28T11:01:46.761Z","avatar_url":"https://github.com/sample-by-jsakamoto.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blazor Samples - How to send HTTP requests to the anonymously accessible endpoint without access token on an authentication enabled Blazor Wasm App?\n\nThis is a sample code repository of a Blazor Wasm app.\n\nThis repository describes how to send HTTP requests to the anonymously accessible endpoint without access token on an authentication enabled Blazor Wasm App.\n\n## What is a problem?\n\nThe `master` branch reproduces the problem what this repository will describe.\n\nIf you clone this repository on your computer, check out the `master` branch, and execute \"dotnet run\", you will see `AccessTokenNotAvailableException` error.\n\n![fig.1](.assets/fig1.png)\n\nThis error causes when sending HTTP requests from the Blazor Wasm App to the Web API endpoint live in it's hosted server process before signed in, even though that endpoint is allowed anonymous access.\n\nBecause the Blazor app which was created from the default project template with the \"Authentication\" option enabled always tries to attach an access token to any HTTP requests whether the user is signed in or not.\n\n## Solutions\n\n### Solution 1\n\n[The `soulution1` branch](https://github.com/sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest/commits/solution1) resolved the issue above, by configuring \"AuthorizationMessageHanlder\" to allow attaching an access token to only selected endpoint under the specified subpath.\n\n### Solution 2\n\n[The `soulution2` branch](https://github.com/sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest/commits/solution2) also resolved that issue.\n\nThis solution explicitly gets a named HTTP client which is configured to attach an access token from \"IHttpClientFactory\", when sending HTTP requests to authorization required endpoint.\n\n\n### Solution 3\n\n[The `soulution3` branch](https://github.com/sample-by-jsakamoto/Blazor-AllowNoAuthHttpRequest/commits/solution3) is another solution of opposite to \"solution2\".\n\nThis solution explicitly gets a named HTTP client which is plain one from \"IHttpClientFactory\", when sending HTTP requests to anonymous access allowed endpoint.\n\n## License\n\n[The Unlicense](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsample-by-jsakamoto%2Fblazor-allownoauthhttprequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsample-by-jsakamoto%2Fblazor-allownoauthhttprequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsample-by-jsakamoto%2Fblazor-allownoauthhttprequest/lists"}