'Google OAuth 2.0 using Endpoints, Youtube readonly scope

I am using new oauth2Endpoint to access youtube readonly permission and also Token to authorize with firebase auth in Next.js

 // Parameters to pass to OAuth 2.0 endpoint.
    var params = {
      client_id: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
      redirect_uri: 'http://localhost:3000/authorize/',
      response_type: 'token',
      scope: 'https://www.googleapis.com/auth/youtube.readonly',
      include_granted_scopes: 'true',
      state: 'authorized',
    };

Response

asPath:"/authorize#state=authorized&access_token=ya29.a0ARrdaM_Z-DtT8QirWCb9phht7k8ePDDPzwSmvtAkm0ecv18KkLg71LeFlURKO6rLfsT66MxRC9SgkenqN7SHPg89Hp5ESpzDBsaTjeJTbx24g-_-18inaSvnmmKTzz68XLrnryyehFGn7-LGozKwVOe9RsZg&token_type=Bearer&expires_in=3599&scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile%20openid%20https://www.googleapis.com/auth/youtube.readonly&authuser=0&prompt=consent"

How to get results in query (/authorize?) instead of (/authorize#)

Callback URL is http://localhost:3000/authorize/



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source