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

read client grant from remote source correctly #17

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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