Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invite_user_by_email doesn't work well #46

Closed
TiannV opened this issue Sep 18, 2021 · 1 comment
Closed

invite_user_by_email doesn't work well #46

TiannV opened this issue Sep 18, 2021 · 1 comment

Comments

@TiannV
Copy link

TiannV commented Sep 18, 2021

When i use invite_user_by_email like this:

import os
import time
from supabase_py import create_client, Client

url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)
# Sign in using the user email and password.
random_email: str = "[email protected]"
random_password: str = "fqj13bnf2hiu23h"
user = supabase.auth.sign_in(email=random_email, password=random_password)
print(user)
res = supabase.auth.api.invite_user_by_email(email="[email protected]")
print(res)

it returns

{'access_token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjMxOTQ5NjAwLCJzdWIiOiJmNmQ2N2UwZS0wMGE0LTRmMTQtODMzNi02MzZhMDA4MTFlNzQiLCJlbWFpbCI6InRpYW53ZWlzdHlsZUBnbWFpbC5jb20iLCJwaG9uZSI6IiIsImFwcF9tZXRhZGF0YSI6eyJwcm92aWRlciI6ImVtYWlsIn0sInVzZXJfbWV0YWRhdGEiOnt9LCJyb2xlIjoiYXV0aGVudGljYXRlZCJ9._Su3gKyoH4F1xqhpDoJ3jLstrna62bw0KlpgfXCxBao', 'token_type': 'bearer', 'expires_in': 3600, 'refresh_token': 'RGYuYWIgyXR-Un3CPM_lzw', 'user': {'id': 'f6d67e0e-00a4-4f14-8336-636a00811e74', 'aud': 'authenticated', 'role': 'authenticated', 'email': '[email protected]', 'email_confirmed_at': '2021-09-18T06:03:30.045114Z', 'phone': '', 'confirmed_at': '2021-09-18T06:03:30.045114Z', 'email_change_confirm_status': 0, 'last_sign_in_at': '2021-09-18T06:20:00.979290632Z', 'app_metadata': {'provider': 'email'}, 'user_metadata': {}, 'created_at': '2021-09-18T06:03:29.935682Z', 'updated_at': '2021-09-18T06:20:00.985069Z'}, 'status_code': 200}
{'code': 401, 'msg': 'User not allowed', 'status_code': 401}
@TiannV
Copy link
Author

TiannV commented Sep 18, 2021

SUPABASE_KEY should set to the value ofservice_role

@TiannV TiannV closed this as completed Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant