コード例 #1
0
        /// <summary>
        /// Sends a Magic email login link to the specified email.
        /// </summary>
        /// <param name="email"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public async Task <bool> SignIn(string email, SignInOptions options = null)
        {
            await DestroySession();

            try
            {
                await api.SendMagicLinkEmail(email, options);

                return(true);
            }
            catch (RequestException ex)
            {
                throw ExceptionHandler.Parse(ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Sends a magic login link to an email address.
        /// </summary>
        /// <param name="email"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public Task <BaseResponse> SendMagicLinkEmail(string email, SignInOptions options = null)
        {
            var data = new Dictionary <string, string> {
                { "email", email }
            };

            if (options != null)
            {
                if (!string.IsNullOrEmpty(options.RedirectTo))
                {
                    data.Add("redirect_to", options.RedirectTo);
                }
            }

            return(Helpers.MakeRequest(HttpMethod.Post, $"{Url}/magiclink", data, Headers));
        }
コード例 #3
0
        /// <summary>
        /// Sends a Magic email login link to the specified email.
        /// </summary>
        /// <param name="email"></param>
        /// <param name="options"></param>
        /// <param name="signInOptions"></param>
        /// <returns></returns>
        public static async Task <bool> SignIn(string email, StatelessClientOptions options, SignInOptions signInOptions = null)
        {
            try
            {
                await GetApi(options).SendMagicLinkEmail(email, signInOptions);

                return(true);
            }
            catch (RequestException ex)
            {
                throw ExceptionHandler.Parse(ex);
            }
        }
コード例 #4
0
 /// <summary>
 /// Sends a Magic email login link to the specified email.
 /// </summary>
 /// <param name="email"></param>
 /// <returns></returns>
 public static Task <bool> SendMagicLink(string email, StatelessClientOptions options, SignInOptions signInOptions = null) => SignIn(email, options, signInOptions);
コード例 #5
0
 /// <summary>
 /// Sends a Magic email login link to the specified email.
 /// </summary>
 /// <param name="email"></param>
 /// <returns></returns>
 public Task <bool> SendMagicLink(string email, SignInOptions options = null) => SignIn(email, options);