rayluo / identity

This is an authentication/authorization library optimized for web apps. It provides some higher level APIs built on top of Microsoft's MSAL Python. Read its documentation here: https://identity-library.readthedocs.io
https://identity-library.readthedocs.io
MIT License
48 stars 6 forks source link

`next_link` not used in flask.Auth.login #27

Closed runxiyu closed 4 months ago

runxiyu commented 4 months ago

(This issue is based on what's in commit 341420da9adc02e498b8bf55fa319d5c091593ff)

flask.Auth.login_required (which the documentation recommends me to use) calls flask.Auth.login with a seemingly correct next_link attribute:

    def login(self, *, next_link: str=None, scopes: List[str]=None):
        ...
            return self.login(
                next_link=request.path,  # https://flask.palletsprojects.com/en/3.0.x/api/#flask.Request.path
                scopes=scopes,
                )

But flask.Auth.login never uses next_link where it probably should:

        log_in_result = self._auth.log_in(
            scopes=scopes,  # Have user consent to scopes (if any) during log-in
            redirect_uri=self._redirect_uri,
            prompt="select_account",  # Optional. More values defined in  https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
            )

It seems that adding next_link=next_link as a parameter works.

        log_in_result = self._auth.log_in(
            scopes=scopes,  # Have user consent to scopes (if any) during log-in
            redirect_uri=self._redirect_uri,
            next_link=next_link,
            prompt="select_account",  # Optional. More values defined in  https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
            )

Apologies on how I am quite unfamiliar with GitHub issues. I've read that there's a predefined way to quote and link lines but I don't seem to know how to get that to work.