Skip to content

Incorrect handling for denied authorization attempts #36

@ThisIsMissEm

Description

@ThisIsMissEm

In OAuth, you can receive a request to the redirect_uri with the parameter error, this can happen for a variety of reasons, but the most common one is "the user has denied access", in this case the error parameter will be set to access_denied

I believe it's a case of adding in logic like:

			let error = callbackURL.queryItems?.first(where: { $0.name == "error" })?.value
			if let error = error {
				switch error.lowercased() {
				case "access_denied":
					throw AuthenticatorError.accessDenied
				default:
					// We do actually have error and error_description parameters, so
					// could create a more specific error than missingAuthorizationCode
					throw AuthenticatorError.missingAuthorizationCode
				}
			}

Likely to the performUserAuthentication(manual: Bool, userAuthenticator: UserAuthenticator) method, after it has invoked userAuthenticator.

At present, the error you get is just the AuthenticatorError.missingAuthorizationCode raised in, for example, the Bluesky service, due to missing parameters (code, iss, or state).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions