Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
read client grant from remote source correctly (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkappa authored Jun 1, 2018
1 parent 4288d98 commit 9ccc29f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions auth0/resource_auth0_client_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func createClientGrant(d *schema.ResourceData, m interface{}) error {
return err
}
d.SetId(g.ID)
return nil
return readClientGrant(d, m)
}

func readClientGrant(d *schema.ResourceData, m interface{}) error {
Expand All @@ -51,6 +51,9 @@ func readClientGrant(d *schema.ResourceData, m interface{}) error {
return err
}
d.SetId(g.ID)
d.Set("client_id", g.ClientID)
d.Set("audience", g.Audience)
d.Set("scope", g.Scope)
return nil
}

Expand All @@ -63,7 +66,7 @@ func updateClientGrant(d *schema.ResourceData, m interface{}) error {
if err != nil {
return err
}
return nil
return readClientGrant(d, m)
}

func deleteClientGrant(d *schema.ResourceData, m interface{}) error {
Expand Down
1 change: 1 addition & 0 deletions auth0/resource_auth0_client_grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func TestAccClientGrant(t *testing.T) {
Config: testAccClientGrantConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client_grant.my_client_grant", "audience", "https://api.example.com/client-grant-test"),
resource.TestCheckResourceAttr("auth0_client_grant.my_client_grant", "scope.0", "create:foo"),
),
},
},
Expand Down

0 comments on commit 9ccc29f

Please sign in to comment.