# 최근 적용된 api\_username 제한?

**URL:** <https://meta.discourse.org/t/newly-enforced-api-username-restriction/168295>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [10월 26, 2020, 3:51오후 UTC](https://meta.discourse.org/t/newly-enforced-api-username-restriction/168295 "2020-10-26T15:51:13Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [10월 29, 2020, 12:12오후 UTC](https://meta.discourse.org/t/newly-enforced-api-username-restriction/168295/3 "2020-10-29T12:12:53Z")

</div>

이 동작을 변경했을 만한 최근 변경 사항은 알지 못합니다. 항상 이 방식(사용자를 찾을 수 없는 경우 오류 표시)으로 작동한다고 생각했습니다. API 자격 증명에서 사용자 이름을 읽을 수 있는지 확인하는 [코드가 바로 이것](https://github.com/discourse/discourse/blame/master/lib/auth/default_current_user_provider.rb)입니다.

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/4/a42c928c5f6219b849a5940922dab8022050ec2a.png)

그리고 아래 `user`는 존재하지 않기 때문에 `nil`이 되며, 이로 인해 131번째 줄에서 위의 오류 메시지가 발생합니다.

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/4/746ccfdd900646c960bc7572f0ff3db289359003.png)

23일 전에 최근 변경 사항이 있었지만, 이는 당신의 상황에 해당하지 않으며 어쨌든 다른 오류 메시지를 반환합니다.

확인을 위해, 1년 이상 지난 [이 커밋](https://github.com/discourse/discourse/commit/dc9110cc434b0c0f3d6bec8d992c6caea31e273c)을 사용하여 로컬 discourse를 설정해 보았는데, 존재하지 않는 사용자를 사용하면 동일한 오류가 발생합니다.

이로 인해 좋은 점 하나는 이제 API 스코프가 있다는 것입니다. 사용자가 `read` 접근 권한만 필요하면, 해당 API 키를 업데이트하여 더 이상 전체 접근 권한 키가 아니도록 설정할 수 있습니다.

---

_[View the full topic](https://meta.discourse.org/t/newly-enforced-api-username-restriction/168295)._
