# AuthSdkError: Unable to parse a token from the url

**URL:** <https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996>\
**Category:** Questions\
**Created:** [January 7, 2018, 5:36am UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996 "2018-01-07T05:36:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelWei](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MichaelWei](https://devforum.okta.com/u/MichaelWei)\
**Post date:** [January 7, 2018, 5:36am UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/1 "2018-01-07T05:36:34Z")

</div>

During using Okta, I encountered the following error:

> AuthSdkError: Unable to parse a token from the url

The implicit redirect url is:

```
http://ip_address_:8080/implicit/callback#id_token=eyJraWQiOiI5ZEh0MkxvLWJZakl5eFhhYkFVTjc1WUhTdFNwdzVZQWtRakZmSDQyazlvIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwMHVkNnoxdnBvZlBaeERoRTBoNyIsIm5hbWUiOiJNaWNoYWVsIFdlaSIsImVtYWlsIjoibWljaGFlbGRvdWRvdUBob3RtYWlsLmNvbSIsInZlciI6MSwiaXNzIjoiaHR0cHM6Ly9kZXYtOTM4NzYwLm9rdGFwcmV2aWV3LmNvbS9vYXV0aDIvZGVmYXVsdCIsImF1ZCI6IjBvYWQ2eW51MnM4TjJZTXVsMGg3IiwiaWF0IjoxNTE1MzAyMTM1LCJleHAiOjE1MTUzMDU3MzUsImp0aSI6IklELjUzSTZZSk5WdG4xYl9zLWRPaWUyT0JWa3lYdlMtNndDRTFDR2o0S0RPc2siLCJhbXIiOlsicHdkIl0sImlkcCI6IjAwb2Q2ejF2bjBTcmZNcDAzMGg3Iiwibm9uY2UiOiJrYm96V2FlVkJyNEFCekYxRkZMamxvOHBmcHFxdkFTT0p1VFBaSVNkVWlUdXZqQ3VHNkd2YkJ1ZE1YeE40Skc5IiwicHJ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wLjUcIYgZFjBnvNeoF6DzkkU_9dqPdokNjwclqClt6KiY5KSlnQxL6BFyQ6iyy9CLXgkVUGiSks6Q9hateVkg2n8kRllae5LpaPQWPXtk1NOt92dk-n2am9XeznM7tu5IfhL7XR79Z8IT9YPTRq5Y5c-3FGhkMhj-pktLLDO4d6mz6J2JZZcQNy-6mLZzeFAzqIB6fMD9ZHjckOrihKkcGs8Fcnc_fCClugYk9pV2aUM9GcMbEc-_nPUF4AtgzRHKPkFP_UfgPFlQ
 &token_type=Bearer
 &expires_in=3600
 &scope=openid+email+profile
 &state=AXpspFnZZM4ywfK7kKIfseHzpsilbdiqLwZh9GKTDBBjkobuyDrozulg2xXCGze7

```

The same code works fine on my localhost, but when I moved the code to Google Cloud, the browser generates the above error.

I have checked everything, including adding my ip\_addr in the “application” configuration of Okta. What could be the cause of it?

---

<div class="post-metadata">

**Author:** ![nate.barbettini](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/nate.barbettini/32/385_2.png) [@nate.barbettini](https://devforum.okta.com/u/nate.barbettini)\
**Post date:** [January 8, 2018, 6:08pm UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/2 "2018-01-08T18:08:15Z")

</div>

That is odd. Are there any other errors in the browser console or network inspector?

Can you post your code that calls the widget or Auth.js? What does that configuration look like?

---

<div class="post-metadata">

**Author:** ![MichaelWei](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MichaelWei](https://devforum.okta.com/u/MichaelWei)\
**Post date:** [February 2, 2018, 3:51pm UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/3 "2018-02-02T15:51:12Z")

</div>

I was away for something else, just came back to this problem.

Several things to update:  
(1) I checked okta website, the login was successful. That means that okta successfully received and parsed the token; but the web page shows: “AuthSdkError: Unable to parse a token form the url”.  
(2) The same code works perfectly on my laptop with localhost as ip address. However, it doesn’t work on Google cloud where I use a company address.

Here is the code:  
const config = {  
issuer: ‘[https://dev-938760.oktapreview.com/oauth2/default](https://dev-938760.oktapreview.com/oauth2/default)’,  
redirect\_uri: ‘http://’ + host\_name + host\_port + ‘/implicit/callback’,  
client\_id: auth\_client\_id  
}

class Login extends Component {  
render() {

```
console.log("login...")
return (
  <Router>
    <Security issuer={config.issuer}
              client_id={config.client_id}
              redirect_uri={config.redirect_uri}
    >
      <Route path='/' exact={true} component={Home}/>
      <Route path='/implicit/callback' component={ImplicitCallback}/>
    </Security>
  </Router>
);

```

}  
}

---

<div class="post-metadata">

**Author:** ![MichaelWei](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MichaelWei](https://devforum.okta.com/u/MichaelWei)\
**Post date:** [February 2, 2018, 3:53pm UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/4 "2018-02-02T15:53:11Z")

</div>

Never mind, I think I found problem.

After I changed from host name to ip address, it suddenly worked.

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [February 2, 2018, 4:00pm UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/5 "2018-02-02T16:00:32Z")

</div>

That is really interesting… I don’t know how the hostname would cause the parser to break. Is there anything you would consider special about the hostname?

---

<div class="post-metadata">

**Author:** ![MichaelWei](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MichaelWei](https://devforum.okta.com/u/MichaelWei)\
**Post date:** [February 2, 2018, 4:17pm UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/6 "2018-02-02T16:17:08Z")

</div>

Nope, there is nothing special about the hostname.

---

<div class="post-metadata">

**Author:** ![Sean2](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sean2](https://devforum.okta.com/u/Sean2)\
**Post date:** [November 20, 2018, 4:36pm UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/7 "2018-11-20T16:36:01Z")

</div>

I’m having almost the exact same problem as this but I’m not sure I can put in my ip address to fix it.

Again, it’s working perfectly on localhost then it’s giving me an AuthSdkError in the browser console on staging.

The other thing I’ve noticed is my callback is returning a 301 status and it doesn’t appear to have a cookie with the token as it does on localhost.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 13, 2024, 12:00am UTC](https://devforum.okta.com/t/authsdkerror-unable-to-parse-a-token-from-the-url/996/8 "2024-01-13T00:00:59Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
