Skip to content

Callback Error Handling #883

@bmulholland

Description

@bmulholland

Version

v4.9.1

Reproduction link

https://nuxt-auth.herokuapp.com/callback?error=access_denied&error_description=The%20user%20has%20denied%20your%20application%20access.&error_uri=https%3A%2F%2Fdocs.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23access-denied&state=mk-asdfasdf

Steps to reproduce

If something goes wrong with OAuth, or the user clicks "cancel" partway through, they are redirected to the callback page and no error mechanism is available. onError isn't thrown, and there's no built-in convenience methods to deal with this. The error is not displayed on the page, and the nuxt error page is not displayed. The code just bails:

Digging through the code, it does seem that fetchUser is called in this situation, and it would /seem/ like callOnError should be called as a result:

this.callOnError(error, { method: 'fetchUser' })

However, in this case, oauth2 just returns outright, which is not an error to be caught, and so it all falls right through.

The demo app is affected by this bug: https://nuxt-auth.herokuapp.com/callback?error=access_denied&error_description=The%20user%20has%20denied%20your%20application%20access.&error_uri=https%3A%2F%2Fdocs.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23access-denied&state=mk-asdfasdf

What is expected ?

I'd expect there to be some way to handle these types of errors. Probably a hook for receiving the error message, and probably a redirect - to home or login page or error page.

What is actually happening?

User sees endless spinner and there's no built-in way to catch it.

Additional comments?

This seems like it should be core functionality? Am I missing something?

This bug report is available on Nuxt community (#c706)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions