> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IXtfUserClient::SigninUser

> IXtfUserClient::SigninUser

# IXtfUserClient::SigninUser

登入以電子郵件地址指定的使用者，並視需要將使用者新增至主機。

<Info>在此版本中，此方法透過網路將密碼文字傳遞至主機時不會加密。如果此行為在您的網路環境中是個問題，請使用 [AddUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/adduser-ixtfuserclient-xtfuser-xbox-windows-m) 方法將使用者新增至主機，然後使用主機上的登入應用程式來登入使用者並儲存使用者密碼。(登入應用程式會透過網路傳送加密的密碼。) 之後，您就可以使用此方法登入，而不需傳遞密碼。</Info>

<a id="syntaxSection" />

## 語法

```cpp theme={null}
public:
HRESULT SigninUser(
         LPCWSTR emailAddress,
         LPCWSTR password,
         BOOL bStorePassword,
         UINT32 *pUserId
)  
```

<a id="ID4E1" />

<a id="parametersSection" />

### 參數

*emailAddress*\
類型：LPCWSTR

使用者的電子郵件地址。

*password*\
類型：LPCWSTR

用於登入的密碼。如果已在主機上為此使用者儲存密碼，請傳遞 `nullptr` 以使用儲存的密碼登入。

*bStorePassword*\
類型：BOOL

如果為 TRUE，則會將指定的密碼儲存在主機上以供日後使用。

*pUserId*\
類型：UINT32 \*

成功登入時，指向使用者的使用者識別碼。

<a id="ID4EDB" />

<a id="retvalSection" />

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

<a id="remarks" />

<a id="remarksSection" />

## 備註

如果使用者已登入，呼叫此方法不會有任何作用。

此方法可能會傳回下列錯誤碼。

| 錯誤碼 | 意義 |
| - | - |
| 0x80048823 | 電子郵件地址無效。 |
| 0x8004882E | 指定使用者的密碼未儲存在主機上。您必須在登入作業中提供密碼。 |
| 0x80048821 | 為使用者指定的密碼無效。 |
| 0x8015DC16 | 使用者已在另一部主機上登入。 |

若要透過指定使用者識別碼來登入使用者，請使用 [SigninUserId](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signinuserid-ixtfuserclient-xtfuser-xbox-windows-m)。

若要登出使用者，請使用 [SignoutUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signoutuser-ixtfuserclient-xtfuser-xbox-windows-m) 或 [SignoutUserId](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signoutuserid-ixtfuserclient-xtfuser-xbox-windows-m)。

<a id="requirementsSection" />

## 需求

**標頭：** xtfuser.h

**程式庫：** xtfuser.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

<a id="seealsoSection" />

## 另請參閱

[IXtfUserClient 介面](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/ixtfuserclient-xtfuser-xbox-windows-t)


## Related topics

- [IXtfUserClient::SigninUserId](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signinuserid-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::SignoutUserId](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signoutuserid-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::SignoutUser](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/signoutuser-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::AddUser 方法](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/adduser-ixtfuserclient-xtfuser-xbox-windows-m.md)
- [IXtfUserClient::ListUsers](/zh-TW/reference/tools/xtf/xtfuser/classes/IXtfUserClient/methods/listusers-ixtfuserclient-xtfuser-xbox-windows-m.md)
