@@ -271,7 +271,7 @@ with_repo(BaseConfig, Fun) ->
271271% % <li>`repo_key' from `get_auth_config' callback - passthrough</li>
272272% % <li>`auth_key' from `get_auth_config' when `trusted' is true and `oauth_exchange' is true - exchange for OAuth token</li>
273273% % <li>`auth_key' from `get_auth_config' when `trusted' is true - use directly</li>
274- % % <li>Global OAuth token from `get_oauth_tokens' callback</li>
274+ % % <li>Global OAuth token from `get_oauth_tokens' callback for Hex.pm repositories </li>
275275% % <li>No auth when `optional' is true (with retry on 401)</li>
276276% % <li>Prompt via `should_authenticate' when `auth_inline' is true</li>
277277% % </ol>
@@ -473,7 +473,7 @@ resolve_api_auth(_Permission, Config) ->
473473% % 1. repo_key from get_auth_config => passthrough
474474% % 2. trusted + auth_key + oauth_exchange => exchange for OAuth token
475475% % 3. trusted + auth_key => use directly
476- % % 4. trusted + global OAuth tokens => use those
476+ % % 4. trusted Hex.pm or child repository + global OAuth tokens => use those
477477% % 5. Fallthrough to no_auth (handled by with_repo/3 for optional/auth_inline)
478478- spec resolve_repo_auth (hex_core :config ()) ->
479479 {ok , binary (), auth_context ()} | no_auth | {error , auth_error ()}.
@@ -515,15 +515,22 @@ do_resolve_repo_auth(RepoName, LookupRepo, Config) ->
515515 [ParentName , _OrgName ] ->
516516 do_resolve_repo_auth (RepoName , ParentName , Config );
517517 _ ->
518- % % 6. trusted + global OAuth tokens => use those
519- resolve_global_oauth_for_repo (Config )
518+ % % 6. trusted Hex.pm or child repository + global OAuth tokens => use those
519+ resolve_global_oauth_for_repo (RepoName , Config )
520520 end ;
521521 _ ->
522522 % % 7. Not trusted, no auth
523523 no_auth
524524 end .
525525
526526% % @private
527+ resolve_global_oauth_for_repo (<<" hexpm" >>, Config ) ->
528+ resolve_global_oauth_for_repo (Config );
529+ resolve_global_oauth_for_repo (<<" hexpm:" , _ /binary >>, Config ) ->
530+ resolve_global_oauth_for_repo (Config );
531+ resolve_global_oauth_for_repo (_RepoName , _Config ) ->
532+ no_auth .
533+
527534resolve_global_oauth_for_repo (Config ) ->
528535 case resolve_oauth_token_with_context (Config ) of
529536 {ok , Token , AuthContext } ->
0 commit comments