Desktop
Last updated
Last updated
The init method is been used to initialize the SDK with the specified auth service and auth config. This returns the SDK instance with auth object to be used.
Leap Near SDK supports two types of authentication services. You can choose which one you want to go ahead with.
Web3Auth -
Ramper -
Using Web3Auth, Leap Near SDK is supporting Google for now, where the user is expected to provide the following config.
For using the Ramper the params are specified below while initializing the SDK.
Once the SDK is been initialized with the expected auth provider, we would be getting the SDK object with auth
property.
The sdk.auth
contains the methods to
Connect to the social login,
Getting the user information
Logging out the user
auth.connect()
would show the google login screen for the user to select the account for which the wallet needs to be created. If the user comes the first time it will create the wallet in the near chain and if it is a returning user it will get the public address of the user.
auth.connect()
would show the popup modal for doing the social login for the user. If the user comes the first time it will create the wallet in the near chain and if it is a returning user it will get the public address of the user.
auth.getUser()
would provide the user information like,
auth.logout()
will log the user out of the session.