Class AuthService

Handles authentication.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

authProxyUrl?: URL

The URL to the proxy server to use for authentication.

Methods

  • Fetches the requested resource from Twitter and returns it after processing.

    Type Parameters

    • OutType extends User | Tweet

      The type of deserialized data returned.

    Parameters

    • resourceType: EResourceType

      The type of resource to fetch.

    • args: FetchArgs

      Resource specific arguments.

    Returns Promise<CursoredData<OutType>>

    The processed data requested from Twitter.

  • Login to twitter as guest.

    Returns Promise<string>

    A new guest key.

    Example

    import { Rettiwt } from 'rettiwt-api';

    // Creating a new Rettiwt instance
    const rettiwt = new Rettiwt();

    // Logging in an getting a new guest key
    rettiwt.auth.guest()
    .then(guestKey => {
    // Use the guest key
    ...
    })
    .catch(err => {
    console.log(err);
    });
  • Login to twitter using account credentials.

    Parameters

    • email: string

      The email id associated with the Twitter account.

    • userName: string

      The username associated with the Twitter account.

    • password: string

      The password to the Twitter account.

    Returns Promise<string>

    The API_KEY for the Twitter account.

    Example

    import { Rettiwt } from 'rettiwt-api';

    // Creating a new Rettiwt instance
    const rettiwt = new Rettiwt();

    // Logging in an getting the API_KEY
    rettiwt.auth.login("email@domain.com", "username", "password")
    .then(apiKey => {
    // Use the API_KEY
    ...
    })
    .catch(err => {
    console.log(err);
    });
  • Posts the requested resource to Twitter and returns the response.

    Parameters

    • resourceType: EResourceType

      The type of resource to post.

    • args: PostArgs

      Resource specific arguments.

    Returns Promise<boolean>

    Whether posting was successful or not.

Generated using TypeDoc