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

Im getting error code 401 on signingUp newuser #10

Closed
Dhiraj23082000 opened this issue Jul 2, 2020 · 8 comments
Closed

Im getting error code 401 on signingUp newuser #10

Dhiraj23082000 opened this issue Jul 2, 2020 · 8 comments

Comments

@Dhiraj23082000
Copy link

No description provided.

@Dhiraj23082000
Copy link
Author

signUp(user).then((cubeUser) {
print("signedin")

}).catchError();

Im using this function directly for signig up a user.

@Dhiraj23082000
Copy link
Author

@TatankaConCube can you help me in resolving this?

@TatankaConCube
Copy link
Contributor

hello @Dhiraj23082000, please provide full log from flutter console, not only stacktrace but full from start app to getting this error

@Dhiraj23082000
Copy link
Author

I/flutter (17757): CB-SDK: : =========================================================
I/flutter (17757): === REQUEST ==== 3677ee6d-892e-4a24-bba2-73c3568fc303 ===
I/flutter (17757): REQUEST
I/flutter (17757): POST https://api.connectycube.com/session
I/flutter (17757): HEADERS
I/flutter (17757): {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 0.2.0-beta3, CB-Token: }
I/flutter (17757): BODY
I/flutter (17757): {"application_id":"2826","auth_key":"JndvLOZAYbz9wcn","nonce":"1096963095","timestamp":"1593693619","signature":"7d12d8e2373d151fb3eb55b044a1f1908e9e9f5e","user":{"login":"marvin18","email":"awesomeman@gmail.com","password":"supersecurepwd"}}
I/flutter (17757):
I/flutter (17757): CB-SDK: : *********************************************************
I/flutter (17757): *** RESPONSE *** 401 *** 3677ee6d-892e-4a24-bba2-73c3568fc303 ***
I/flutter (17757): HEADERS
I/flutter (17757): {connection: keep-alive, set-cookie: _mkra_ctxt=6d2e6b61682f815c8cc7829ca717a036--401; path=/; max-age=5; HttpOnly; secure, cache-control: no-cache, status: 401 Unauthorized, transfer-encoding: chunked, date: Thu, 02 Jul 2020 12:40:23 GMT, access-control-allow-origin: *, strict-transport-security: max-age=31536000, content-type: application/json; charset=utf-8, x-xss-protection: 1; mode=block, server: nginx/1.16.1, x-request-id: 1154020c-c59a-4ffd-9f34-00f3cc7e67bd, connectycube-rest-api-version: 0.1.1, x-runtime: 0.020672, x-frame-options: SAMEORIGIN, x-content-type-options: nosniff}
I/flutter (17757): BODY
I/flutter (17757): {"errors":["Unauthorized"]}
I/flutter (17757):
I/flutter (17757): CB-SDK: LoginScreen.BodyState: Login error ResponseException: 401: {"errors":["Unauthorized"]}

@Dhiraj23082000
Copy link
Author

@TatankaConCube this is the full log from the debugconsole

@TatankaConCube
Copy link
Contributor

It is strange, because you say about signUp(user) but in logs I see request which looks like createSession(user). Can you check your code again?
Log example for signUp(user):
Create blank session:

I/flutter ( 9958): CB-SDK: : =========================================================
I/flutter ( 9958): === REQUEST ==== b4c00200-8702-4719-843e-0d374dc92537 ===
I/flutter ( 9958): REQUEST
I/flutter ( 9958):   POST https://api.connectycube.com/session 
I/flutter ( 9958): HEADERS
I/flutter ( 9958):   {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 0.2.0-beta3, CB-Token: }
I/flutter ( 9958): BODY
I/flutter ( 9958):   {"application_id":"476","auth_key":"PDZjPBzAO8WPfCp","nonce":"28907064","timestamp":"1593695181","signature":"a73bc71edda3cf522f89ef2fef50ac4add56d161"}
I/flutter ( 9958): 
I/flutter ( 9958): CB-SDK: : *********************************************************
I/flutter ( 9958): *** RESPONSE *** 201 *** b4c00200-8702-4719-843e-0d374dc92537 ***
I/flutter ( 9958): HEADERS
I/flutter ( 9958):   {connection: keep-alive, cache-control: max-age=0, private, must-revalidate, set-cookie: _mkra_ctxt=4ac03af8c01f3a25ac57cb279db0cbde--201; path=/; max-age=5; HttpOnly; secure, status: 201 Created, transfer-encoding: chunked, date: Thu, 02 Jul 2020 13:06:20 GMT, access-control-allow-origin: *, strict-transport-security: max-age=31536000,max-age=15768000;, content-type: application/json; charset=utf-8, x-xss-protection: 1; mode=block, server: nginx/1.16.1, x-request-id: cd3d616f-b09c-4db7-b941-beb72abbebaa, cb-token-expirationdate: 2020-07-02 15:06:20 UTC, connectycube-rest-api-version: 0.1.1, x-runtime: 0.023349, etag: W/"793d6c155d8e50dd8b7e3a9486c0f1c5", x-frame-options: SAMEORIGIN, x-content-type-options: nosniff}
I/flutter ( 9958): BODY
I/flutter ( 9958):   {"session":{"id":14853709,"user_id":0,"application_id":476,"nonce":28907064,"token":"1d0620302227254d0648af0db029e0a5780001dc","ts":1593695181,"created_at":"2020-07-02T13:06:20Z","updated_at":"2020-07-02T13:06:20Z"}}

SignUp request:

I/flutter ( 9958): CB-SDK: : =========================================================
I/flutter ( 9958): === REQUEST ==== a8bbf290-97d0-4709-9b8a-f80721a66b25 ===
I/flutter ( 9958): REQUEST
I/flutter ( 9958):   POST https://api.connectycube.com/users 
I/flutter ( 9958): HEADERS
I/flutter ( 9958):   {Content-type: application/json, ConnectyCube-REST-API-Version: 0.1.1, CB-SDK: Flutter 0.2.0-beta3, CB-Token: 1d0620302227254d0648af0db029e0a5780001dc}
I/flutter ( 9958): BODY
I/flutter ( 9958):   {"user":{"email":"awesomeman@gmail.com","login":"marvin18","password":"supersecurepwd"}}
I/flutter ( 9958): 
I/flutter ( 9958): CB-SDK: : *********************************************************
I/flutter ( 9958): *** RESPONSE *** 201 *** a8bbf290-97d0-4709-9b8a-f80721a66b25 ***
I/flutter ( 9958): HEADERS
I/flutter ( 9958):   {connection: keep-alive, cache-control: max-age=0, private, must-revalidate, set-cookie: _mkra_ctxt=3abb4e94cf4f793352d19a320b075aff--201; path=/; max-age=5; HttpOnly; secure, status: 201 Created, transfer-encoding: chunked, date: Thu, 02 Jul 2020 13:06:22 GMT, access-control-allow-origin: *, strict-transport-security: max-age=31536000,max-age=15768000;, content-type: application/json; charset=utf-8, x-xss-protection: 1; mode=block, server: nginx/1.16.1, x-request-id: 4e2db49d-0de4-494f-a755-4383d5bec730, cb-token-expirationdate: 2020-07-02 15:06:20 UTC, connectycube-rest-api-version: 0.1.1, location: https://api.connectycube.com/users/1604786, x-runtime: 0.076371, etag: W/"3763977b6896866f3720705cc7aa09a7", x-frame-options: SAMEORIGIN, x-content-type-options: nosniff}
I/flutter ( 9958): BODY
I/flutter ( 9958):   {"user":{"id":1604786,"full_name":null,"email":"awesomeman@gmail.com","login":"marvin18","phone":null,"website":null,"created_at":"2020-07-02T13:06:22Z","updated_at":"2020-07-02T13:06:22Z","last_request_at":null,"external_user_id":null,"facebook_id":null,"twitter_id":null,"blob_id":null,"custom_data":null,"avatar":null,"user_tags":null}}

@TatankaConCube
Copy link
Contributor

You can create session only with registered user. One note - before create user you should create blank session without user.

@Dhiraj23082000
Copy link
Author

Thanks! My issue is resolved.

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

2 participants