The LoginService
provides a comprehensive API for integrating various authentication methods into your Angular application. This reference details the methods available in the LoginService
.
- 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.
Checks if the user is currently logged in.
-
Returns:
boolean
-true
if the user is logged in, otherwisefalse
.
A placeholder for post-login actions. Currently, it does not perform any operations.
Sets the URL for the logo.
-
Parameters:
-
url
:string
- The URL of the logo.
-
Sets the URL to redirect to after login.
-
Parameters:
-
url
:string | null
- The redirect URL.
-
Gets the current logo URL.
-
Returns:
Promise<string>
- The logo URL.
Logs in using a Microsoft OAuth token.
-
Parameters:
-
token
:string
- The OAuth token from Microsoft.
-
Logs in using a GitHub OAuth code.
-
Parameters:
-
code
:string
- The OAuth code from GitHub.
-
Logs in using a Twitter OAuth token.
-
Parameters:
-
token
:string
- The OAuth token from Twitter.
-
Logs in using a Google OAuth token.
-
Parameters:
-
token
:string
- The OAuth token from Google.
-
Retrieves the current wallet address.
-
Returns:
Promise<string>
- The wallet address.
Gets the current JSON RPC provider.
- Returns: The JSON RPC provider.
Logs out the current user, clearing the session and any stored tokens.
Redirects the user after login based on the redirectUrl
.
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.
-
Performs a direct redirect to a custom login page.
Checks if the user is logged in based on the provider.
-
Returns:
boolean | string
-true
if the user is logged in, otherwisefalse
. 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.