def backend_login(title, auth_info, login_data, settings=None): api.set_title(title.TITLE_ID_EUR, title.LATEST_VERSION) nex_token = api.get_nex_token(title.GAME_SERVER_ID) auth_info = None login_data = None if auth_info: auth_info = authentication.AuthenticationInfo(nex_token.token, title.SERVER_VERSION) if login_data: login_data = authentication.NintendoLoginData(nex_token.token) client = backend.BackEndClient(title.ACCESS_KEY, title.NEX_VERSION, settings) client.connect(nex_token.host, nex_token.port) client.login( nex_token.username, nex_token.password, auth_info ) return client
def backend_login(title, use_auth_info, use_login_data, settings=None): nnas.set_title(title.TITLE_ID_EUR, title.LATEST_VERSION) nex_token = nnas.get_nex_token(title.GAME_SERVER_ID) auth_info = None login_data = None if use_auth_info: auth_info = authentication.AuthenticationInfo() auth_info.token = nex_token.token auth_info.server_version = title.SERVER_VERSION if use_login_data: login_data = authentication.NintendoLoginData() login_data.token = nex_token.token client = backend.BackEndClient(settings) clietn.configure(title.ACCESS_KEY, title.NEX_VERSION) client.connect(nex_token.host, nex_token.port) client.login(nex_token.username, nex_token.password, auth_info, login_data) return client
small_image="nn", small_text=MAINID, large_image=title_id.lower()) else: print("Unknown notification type %i (from %s)" % (event.type, name)) def process_presence_change_event(self, context, event): self.process_nintendo_notification_event(context, event) nnas = nnas.NNASClient() nnas.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION) nnas.set_locale(REGION, COUNTRY, LANGUAGE) nnas.set_title(Friends.TITLE_ID_EUR, Friends.LATEST_VERSION) nnas.login(USERNAME, PASSWORD) nex_token = nnas.get_nex_token(Friends.GAME_SERVER_ID) backend = backend.BackEndClient("friends.cfg") backend.configure(Friends.ACCESS_KEY, Friends.NEX_VERSION) backend.connect(nex_token.host, nex_token.port) login_data = authentication.NintendoLoginData() login_data.token = nex_token.token backend.login(nex_token.username, nex_token.password, None, login_data) backend.secure_client.register_server(NotificationServer()) input("Press enter to disconnect and exit\n") backend.close()
api = account.AccountAPI() api.set_device(DEVICE_ID, SERIAL_NUMBER, SYSTEM_VERSION, REGION, COUNTRY) api.set_title(friends.FriendsTitle.TITLE_ID_EUR, friends.FriendsTitle.LATEST_VERSION) api.login(USERNAME, PASSWORD) pid = api.get_pid(USERNAME) mii = api.get_mii(pid) nex_token = api.get_nex_token(friends.FriendsTitle.GAME_SERVER_ID) backend = backend.BackEndClient(friends.FriendsTitle.ACCESS_KEY, friends.FriendsTitle.NEX_VERSION, backend.Settings("friends.cfg")) backend.connect(nex_token.host, nex_token.port) backend.login(nex_token.username, nex_token.password, None, authentication.NintendoLoginData(nex_token.token)) #Even though you're sending your username and pid to the server, you can't #requests friend information of other people. You'll always get your own data client = friends.FriendsClient(backend) principal_preference, comment, friends, requests_sent, requests_received, \ blacklist, unk1, notifications, unk2 = client.get_all_information( friends.NNAInfo( friends.PrincipalBasicInfo( pid, USERNAME, #Pid and nnid #If you change mii name or data here it will also be changed on Nintendo's servers friends.MiiV2(mii.name, 0, 0, mii.data, common.DateTime(0)), 2 ), 0x5E, 0x0B ),