{"action":"created","issue":{"url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2/issues/7","repository_url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2","labels_url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2/issues/7/comments","events_url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2/issues/7/events","html_url":"https://github.com/IdentityModel/IdentityModel.OidcClient2/issues/7","id":210714347,"number":7,"title":"Calling RefreshTokenAsyncthrows exception","user":{"login":"jerriep","id":1006420,"avatar_url":"https://avatars3.githubusercontent.com/u/1006420?v=3","gravatar_id":"","url":"https://api.github.com/users/jerriep","html_url":"https://github.com/jerriep","followers_url":"https://api.github.com/users/jerriep/followers","following_url":"https://api.github.com/users/jerriep/following{/other_user}","gists_url":"https://api.github.com/users/jerriep/gists{/gist_id}","starred_url":"https://api.github.com/users/jerriep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerriep/subscriptions","organizations_url":"https://api.github.com/users/jerriep/orgs","repos_url":"https://api.github.com/users/jerriep/repos","events_url":"https://api.github.com/users/jerriep/events{/privacy}","received_events_url":"https://api.github.com/users/jerriep/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-28T08:05:31Z","updated_at":"2017-03-01T07:44:34Z","closed_at":null,"body":"How is the `RefreshTokenAsync` method supposed to be used? \r\n\r\nWhen I instantiate a new instance of `OidcClient` and call the `RefreshTokenAsync` method with a previously saved `refresh_token`, I get a `NullReferenceException` with the following stack trace relevant to OidcClient\r\n\r\n```\r\nat IdentityModel.OidcClient.Infrastructure.TokenClientFactory.Create(OidcClientOptions options)\r\nat IdentityModel.OidcClient.OidcClient.<RefreshTokenAsync>d__12.MoveNext()\r\n```\r\n\r\nIt would seem that `TokenClientFactory.Create` depends on the `ProviderInformation` being initialized (see https://github.com/IdentityModel/IdentityModel.OidcClient2/blob/dev/src/IdentityModel.OidcClient/Infrastructure/TokenClientFactory.cs#L10-L21).\r\n\r\nWhen I first call `LoginAsync` and then `RefreshTokenAsync`, all works fine, because `EnsureConfigurationAsync` was called in that case (https://github.com/IdentityModel/IdentityModel.OidcClient2/blob/dev/src/IdentityModel.OidcClient/OidcClient.cs#L61), which will load the information from the discovery document.\r\n\r\nAm I misunderstanding the use case. Surely I must be able to initialize an instance of `OidcClient` at a later stage and use it to refresh a token which was previously saved when a user authenticated?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2/issues/comments/283268537","html_url":"https://github.com/IdentityModel/IdentityModel.OidcClient2/issues/7#issuecomment-283268537","issue_url":"https://api.github.com/repos/IdentityModel/IdentityModel.OidcClient2/issues/7","id":283268537,"user":{"login":"leastprivilege","id":1454075,"avatar_url":"https://avatars3.githubusercontent.com/u/1454075?v=3","gravatar_id":"","url":"https://api.github.com/users/leastprivilege","html_url":"https://github.com/leastprivilege","followers_url":"https://api.github.com/users/leastprivilege/followers","following_url":"https://api.github.com/users/leastprivilege/following{/other_user}","gists_url":"https://api.github.com/users/leastprivilege/gists{/gist_id}","starred_url":"https://api.github.com/users/leastprivilege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leastprivilege/subscriptions","organizations_url":"https://api.github.com/users/leastprivilege/orgs","repos_url":"https://api.github.com/users/leastprivilege/repos","events_url":"https://api.github.com/users/leastprivilege/events{/privacy}","received_events_url":"https://api.github.com/users/leastprivilege/received_events","type":"User","site_admin":false},"created_at":"2017-03-01T07:44:34Z","updated_at":"2017-03-01T07:44:34Z","body":"yes that's a bug. fixing it now.\r\n\r\nAnother way to use refresh tokens is via the RefreshTokenHandler. Have you tried that?"}}
{"actor":{"display_login":"leastprivilege"}}