# Methods

## login

The `login` variable is a Wepin login library that includes various authentication methods, allowing users to log in using different approaches. It supports email and password login, OAuth provider login, login using ID tokens or access tokens, and more.

**Available Methods**

* `loginWithOauthProvider`
* `signUpWithEmailAndPassword`
* `loginWithEmailAndPassword`
* `loginWithIdToken`
* `loginWithAccessToken`
* `getRefreshFirebaseToken`
* `loginWepin`
* `getCurrentWepinUser`
* `logout`
* `getSignForLogin`

These methods support various login scenarios, allowing you to select the appropriate method based on your needs.

**Example**

```javascript
// Login using an OAuth provider
const oauthResult = await wepinProvider.login.loginWithOauthProvider({
  provider: 'google',
  clientId: 'your-client-id',
});

// Sign up and log in using email and password
const signUpResult = await wepinProvider.login.signUpWithEmailAndPassword(
  'example@example.com',
  'password123'
);

// Log in to Wepin
const wepinLoginResult = await wepinProvider.login.loginWepin(signUpResult);

// Get the currently logged-in user
const currentUser = await wepinProvider.login.getCurrentWepinUser();

// Logout
await wepinProvider.login.logout();
```

## getProvider

```javascript
await wepinProvider.getProvider(network);
```

It returns a Provider by given network.

#### **Parameters**

* `network` \<string> - Available chains Wepin helps provide. It should be lowercase. (e.g., "ethereum", "klaytn", "kaia")

#### **Return value**

* Promise\<BaseProvider> - A EIP-1193 compatible provider

#### **Example**

```javascript
const provider = await wepinProvider.getProvider('ethereum');
```

## finalize

```javascript
await wepinProvider.finalize();
```

The `finalize()` method finalizes the Wepin Provider SDK.

#### **Parameters**

* None

#### **Return value**

* Promise\<void>

#### **Example**

```javascript
await wepinProvider.finalize();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/en/widget-integration/react-native-sdk/provider/method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
