-
splatnet3_scraper.auth.NSO.get_gtoken(session_token, f_token_url=
None) Obtains the
gtokenfrom the session token.The GameWebToken, or
gtoken, is used to authenticate requests to the Nintendo Switch Online API. This method will obtain thegtokenfrom the session token. The process of obtaining agtokenis as follows:- Obtain the user access token and the
id_tokenfrom the session token.
- Obtain the user access token and the
Use the user access token to obtain the user’s information.
- Use the
id_tokenand the user’s information to obtain the first f_token, the request ID, and the timestamp.
- Use the
- Use the first
f_token, the request ID, the timestamp, and the id_tokento obtain theweb_service_access_token.
- Use the first
- Use the
web_service_access_tokento obtain the second f_token, request ID, and timestamp.
- Use the
- Use the second
f_token, request ID, timestamp, and the web_service_access_tokento obtain thegtoken.
- Use the second
By default, this method will use a third party’s
f_tokengeneration API to obtain thef_token. The API used by default is provided by imink. If you do not trust this URL, you can provide your own URL through thef_token_urlargument, or you can replace thef_tokengeneration method used with your own through the use of theset_new_f_token_functionmethod. See the documentation for that method for more information.- Parameters:¶
- Raises:¶
NintendoException – In the case that the user’s access token cannot be obtained from the session token, or the user’s information that is returned is invalid.
- Returns:¶
str – The gtoken. This is used to authenticate requests to the Nintendo Switch Online API. This token is valid for 2 hours.