Skip to content

RefreshToken() does not refresh if the session is expired #112

@tiecia

Description

@tiecia

Bug report

Describe the bug

It appears the the RefreshToken() function will not refresh the current token if it has expired. You can see here that it explicitly throws an error if it is expired. How is this proper behavior? Doesn't this behavior defeat the purpose of the refresh token, to be able to refresh the access token if it has already expired? Or is there something I am not understanding with how to use this API?

if (CurrentSession!.Expired())
throw new GotrueException("Session expired", ExpiredRefreshToken);

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Call RefreshToken() when CurrentSession is expired.

Expected behavior

I would expect the current token to be refreshed even if the current token is expired.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions