arthera-login
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Login Service API Reference

The LoginService provides a comprehensive API for integrating various authentication methods into your Angular application. This reference details the methods available in the LoginService.

Properties

  • provider: The JSON RPC provider used for blockchain interactions.
  • wallet: The user's wallet, which can be a Wallet instance or a string representing the address.
  • redirectUrl: The URL to redirect to after login.
  • logoUrl: The URL of the logo to display during the login process.
  • userid: The user's ID, typically obtained from the OAuth provider.

Methods

isLoggedIn()

Checks if the user is currently logged in.

  • Returns: boolean - true if the user is logged in, otherwise false.

afterLogin()

A placeholder for post-login actions. Currently, it does not perform any operations.

setLogoUrl(url: string)

Sets the URL for the logo.

  • Parameters:
    • url: string - The URL of the logo.

setRedirectUrl(url: string | null)

Sets the URL to redirect to after login.

  • Parameters:
    • url: string | null - The redirect URL.

getLogoUrl()

Gets the current logo URL.

  • Returns: Promise<string> - The logo URL.

loginWithMicrosoft(token: string)

Logs in using a Microsoft OAuth token.

  • Parameters:
    • token: string - The OAuth token from Microsoft.

loginWithGithub(code: string)

Logs in using a GitHub OAuth code.

  • Parameters:
    • code: string - The OAuth code from GitHub.

loginWithTwitter(token: string)

Logs in using a Twitter OAuth token.

  • Parameters:
    • token: string - The OAuth token from Twitter.

loginWithGoogle(token: string)

Logs in using a Google OAuth token.

  • Parameters:
    • token: string - The OAuth token from Google.

getAddress()

Retrieves the current wallet address.

  • Returns: Promise<string> - The wallet address.

getProvider()

Gets the current JSON RPC provider.

  • Returns: The JSON RPC provider.

logout()

Logs out the current user, clearing the session and any stored tokens.

continue()

Redirects the user after login based on the redirectUrl.

init(redirectUrl: string, logoUrl: string)

Initializes the login service with a redirect URL and a logo URL.

  • Parameters:
    • redirectUrl: string - The URL to redirect to after login.
    • logoUrl: string - The URL of the logo to display during the login process.

loginWithRedirect()

Performs a direct redirect to a custom login page.

isLoggedInProvider()

Checks if the user is logged in based on the provider.

  • Returns: boolean | string - true if the user is logged in, otherwise false. For Twitter and GitHub, it returns the user ID if present.

This API reference provides a detailed overview of the functionalities offered by the LoginService for integrating authentication into Angular applications.

Readme

Keywords

none

Package Sidebar

Install

npm i arthera-login

Weekly Downloads

0

Version

0.0.2

License

none

Unpacked Size

10.1 kB

Total Files

14

Last publish

Collaborators

  • catalindinu.dev