# Oauth Redirecting to /login after successful user JSON call

**URL:** <https://meta.discourse.org/t/oauth-redirecting-to-login-after-successful-user-json-call/143851>\
**Category:** SSO\
**Tags:** oauth2\
**Created:** [10 במרץ,‏ 2020,‏ 10:52pm UTC](https://meta.discourse.org/t/oauth-redirecting-to-login-after-successful-user-json-call/143851 "2020-03-10T22:52:22Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![patrickeaton](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@patrickeaton](https://meta.discourse.org/u/patrickeaton)\
**Post date:** [10 במרץ,‏ 2020,‏ 10:52pm UTC](https://meta.discourse.org/t/oauth-redirecting-to-login-after-successful-user-json-call/143851/1 "2020-03-10T22:52:22Z")

</div>

My configuration for Oauth basic is behaving quite odd, I had a few errors initially during setup and have resolved them. However, now I can see the flow going from Discourse → Cognito Authorize Endpoint → Discourse Callback → Discourse /login. There is no warning or errors in the log, and when checking the logs, I can see that there is a successful JSON call to grab the user data.

Given that it appears to have a successful token and has loaded the JSON data, I would expect the user account to be successfully registered, instead the user is redirected to the login page.

Please see logs below.

```
OAuth2 Debugging: after_authenticate response: creds: {"token"=>"eyJraWQiOiJ3YW8zbVBRWmh2Z2F6YldNaU5jS3ZOdVdRMXRmcm1ya2ZVZ2RvVjVYSG1RPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJkNzhkZDliNS03Mjc2LTQ5OWEtYjdiN
3:48 pm
OAuth2 Debugging: user_json_url: GET https://api.lifebac.com/token/details?token=eyJraWQiOiJ3YW8zbVBRWmh2Z2F6YldNaU5jS3ZOdVdRMXRmcm1ya2ZVZ2RvVjVYSG1RPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJkNzhkZDliNS03Mjc
3:48 pm
OAuth2 Debugging: user_json_response: #<Excon::Response:0x00007f36a7608a30 @data={:body=>"{\"id\":\"d78dd9b5-7276-499a-b7b6-02da38e03ce9\", ...}", :cookies=>[], :host=>"api.lifebac.com", :headers=>{"Conten
3:48 pm
OAuth2 Debugging: user_json: {"id"=>"d78dd9b5-7276-499a-b7b6-02da38e03ce9", ...}

```

Any help on what is occurring would be incredibly helpful. More than happy to supply the backtraces if needed.

---

_[View the full topic](https://meta.discourse.org/t/oauth-redirecting-to-login-after-successful-user-json-call/143851)._
