plutoless / eEducation

e-education solutions(Agora Reference Design)
184 stars 124 forks source link

login failure, please check your network #153

Closed suretrust closed 4 years ago

suretrust commented 4 years ago

I cloned the repo and I'm trying to set up locally but I get the error in the image attached (login failure, please check your network) each time I try to join a room. Here is the repo I'm working on setting up. Am I setting the .env file wrongly?

In the console, I am getting: index.ts:71 Error: Unauthorized at onResponse

Screenshot 2020-06-05 at 09 44 16
yoreland commented 4 years ago

From response, it seems related with token authorization. Do you enable token on your agora console?

suretrust commented 4 years ago

How do I enable that? @yoreland

yoreland commented 4 years ago

did you check this url? https://docs.agora.io/en/faq/restful_authentication

suretrust commented 4 years ago

Yes, @yoreland, I followed it and added it. It's in the .env file of the repo I added in the post above.

yoreland commented 4 years ago

Just double check your .env file. The restful_token need using base64 encoded token. Currently your are using plain text, try to use MzgzMzM3MGJiZGRmNGE1MTkzMDdjOTYwNDFmMTdjMjM6YjE2MTRlMWUzOTM0NGI0ZWI4MjI5ZGY4MDcwNGNhZTQ=

suretrust commented 4 years ago

I used it and still didn't work. 😢

suretrust commented 4 years ago

What should be my REACT_APP_AGORA_RTM_ENDPOINT? @yoreland

suretrust commented 4 years ago

Also, am I supposed to enclose each constant as a string? For example:

REACT_APP_AGORA_RESTFULL_TOKEN="Basic MzgzMzM3MGJiZGRmNGE1MTkzMDdjOTYwNDFmMTdjMjM6YjE2MTRlMWUzOTM0NGI0ZWI4MjI5ZGY4MDcwNGNhZTQ="

Or it's fine as shown below without the quotes?

REACT_APP_AGORA_RESTFULL_TOKEN=Basic MzgzMzM3MGJiZGRmNGE1MTkzMDdjOTYwNDFmMTdjMjM6YjE2MTRlMWUzOTM0NGI0ZWI4MjI5ZGY4MDcwNGNhZTQ=
yoreland commented 4 years ago

it should be enclosed with quotes, and the word "Basic" could be removed from string like: REACT_APP_AGORA_RESTFULL_TOKEN="MzgzMzM3MGJiZGRmNGE1MTkzMDdjOTYwNDFmMTdjMjM6YjE2MTRlMWUzOTM0NGI0ZWI4MjI5ZGY4MDcwNGNhZTQ="

suretrust commented 4 years ago

Thanks so much, I finally got it to work!

alexwenbj commented 4 years ago

@suretrust Hi,Would you please paste your env.local here after omit your IDs.And can you give me the program you generate the base64 code?Thank you.

plutoless commented 4 years ago

@alexwenbj which platform are you on? i think base64 is a pretty common lib which is available on almost every platform

alexwenbj commented 4 years ago

@plutoless Java platform, I pasted my Java code in #157 .

suretrust commented 4 years ago

Hi @alexwenbj, 👋

REACT_APP_AGORA_APP_ID=agora_app_id_without_quotes
REACT_APP_AGORA_LOG=true

REACT_APP_AGORA_CUSTOMER_ID=customer_id_without_quotes
REACT_APP_AGORA_CUSTOMER_CERTIFICATE=customer_certificate_without_quotes
REACT_APP_AGORA_RTM_ENDPOINT=your_server_rtm_endpoint_api
REACT_APP_AGORA_EDU_ENDPOINT_PREFIX=https://api.agora.io/edu

REACT_APP_YOUR_BACKEND_WHITEBOARD_API=https://api.agora.io/edu/v1/apps/%app_id%/room/%room_id%/board

REACT_APP_AGORA_RESTFULL_TOKEN=Basic MzgzMzM3MGJiZGRmNGE1MTkzMDdjOTYwNDFmMTdjMjM6YjE2MTRlMWUzOTM0NGI0ZWI4MjI5ZGY4MDcwNGNhZTQ=

REACT_APP_YOUR_OWN_OSS_BUCKET_NAME=your_oss_bucket_name
REACT_APP_YOUR_OWN_OSS_BUCKET_FOLDER=your_oss_bucket_folder
REACT_APP_YOUR_OWN_OSS_BUCKET_REGION=your_bucket_region
REACT_APP_YOUR_OWN_OSS_BUCKET_KEY=your_bucket_ak
REACT_APP_YOUR_OWN_OSS_BUCKET_SECRET=your_bucket_sk
REACT_APP_YOUR_OWN_OSS_CDN_ACCELERATE=your_cdn_accelerate_endpoint

Things to note:

Please feel free to ask any other question, hope that helps!

alexwenbj commented 4 years ago

@suretrust Thank you. I resolved this problem.