Skip to content

[go_router] Access to fragment(/#access_token=bla_bla_bla) in router state #108614

Closed

Description

@vasilich6107

Use case

I'm using Amazon Cognito auth and it sends token in redirect URL as /#access_token=bla_bla_bla
On v4.1 it worked well for me and I was able to access to this fragment in state.location.

On v4.2 there is no more fragment in state.location.

Proposal

Could you expose fragment(#access_token=bla_bla_bla) the same way as you do with state.params?

Activity

  1. changed the title [-][go_router] Access to fragment(`/#access_token=bla_bla_bla`) in router state.[/-] [+][go_router] Access to fragment(`/#access_token=bla_bla_bla`) in router `state`[/+] on Jul 29, 2022
  2. added
    in triagePresently being triaged by the triage team
    c: new featureNothing broken; request for a new capability
    packageflutter/packages repository. See also p: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Jul 29, 2022
  3. added
    P2Important issues not at the top of the work list
    on Aug 2, 2022
  4. chunhtai commented on Aug 4, 2022

    @chunhtai
    Contributor

    Is this a regression that it worked on 4.1?

    also can you provide a minimum repro code?

  5. vasilich6107 commented on Aug 5, 2022

    @vasilich6107
    ContributorAuthor

    Ok, will prepare some code

  6. chunhtai commented on Aug 25, 2022

    @chunhtai
    Contributor

    It looks like the fragment is dropped somewhere in the parsing pipeline
    _addQueryParams in match.dart should also append the fragment.

  7. SheriefAlaa commented on Nov 6, 2022

    @SheriefAlaa

    I can reproduce on version 5.1.5. Flutter 3.3.5.

  8. 5 remaining items

  9. vasilich6107 commented on Jul 21, 2023

    @vasilich6107
    ContributorAuthor

    When you refresh the page - the fragment magically disappears

    Screen.Recording.2023-07-21.at.10.46.11.mov
  10. vasilich6107 commented on Jul 21, 2023

    @vasilich6107
    ContributorAuthor

    Hi @chunhtai

    It seems that this line
    https://github.com/flutter/flutter/blob/master/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart#L57

    misses + (_platformLocation.hash ?? '')

    This code works fine. Could you help me with clarification if this is an acceptable solution?

    final String path = _platformLocation.pathname + _platformLocation.search + (_platformLocation.hash ?? '');
  11. chunhtai commented on Jul 21, 2023

    @chunhtai
    Contributor

    yes this looks correct, although I am not the owner of that part of the code. feel free to open a pr and pin me on it, I can help redirect to the right person

  12. vasilich6107 commented on Jul 21, 2023

    @vasilich6107
    ContributorAuthor

    Sure, thanks a lot.
    Will do the PR

  13. vasilich6107 commented on Jul 23, 2023

    @vasilich6107
    ContributorAuthor

    Possibly related issues
    #126044
    #122058

  14. yjbanov commented on Aug 3, 2023

    @yjbanov
    Contributor

    Assigned to @vasilich6107 and @chunhtai who are actively working on the PR.

  15. chunhtai commented on Aug 3, 2023

    @chunhtai
    Contributor

    should be fixed by #131123

  16. github-actions commented on Dec 21, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterfyi-webFor the attention of Web platform teamp: go_routerThe go_router packagepackageflutter/packages repository. See also p: labels.

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions